Skip to content

Instantly share code, notes, and snippets.

@xeoncross
Forked from alexis-gruet-deel/gist:9243496
Created February 27, 2014 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeoncross/9256851 to your computer and use it in GitHub Desktop.
Save xeoncross/9256851 to your computer and use it in GitHub Desktop.
/**
for( $a=1; $a<20; $a++ ) {
echo '----------------------' . PHP_EOL;
echo 'PROJECT_ID :: ' . $a . PHP_EOL;
$last = $c[ 'predis' ]->get( 'round-robin-dispatch' );
$i = $j = -1;
$n = count( $array );
if( isset( $last )) {
$i = $j = $last;
}
do {
$j = ( $j + 1 ) % $n;
if( isset( $array[$j] ) ) {
$i = $j;
$c[ 'predis' ]->set( 'round-robin-dispatch', $i );
$current = $array[ $i ];
}
} while ( $j != $i );
echo 'Will be sent to :: ' . $current . PHP_EOL;
echo 'Will be sent to :: aviva' . PHP_EOL;
sleep( 2 );
}
echo PHP_EOL; **/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment