Closed
Description
This small script crache php.
function f($redis, $chan, $msg) {
echo "Handle message " . $msg . ' for chanel ' . $chan;
}
$r = new Redis();
if($r->connect('127.0.0.1', 6379)) {
echo 'Sleepping' . PHP_EOL;
sleep(5);
$chanel = 'chanel_' . rand(1, 10);
echo 'Subscribe to chanel ' . $chanel . PHP_EOL;
$r->subscribe(array($chanel), 'f');
/* for($i = 0; $i < 10; $i++) {
$r->publish('chanel_' . $i, 'test msg ' . rand(1, 10));
}*/
/*
for($i = 1; $i < 100; $i++) {
echo $i . PHP_EOL;
usleep(100000);
}
*/
} else {
echo "Can`t connect to redis." . PHP_EOL;
}