Closed fayland closed 11 months ago
It seems you somehow mixed Amp v2 and v3. With Revolt / Amp v3, you don't need to explicitly run the event loop or use yield
. I've added an example in https://github.com/amphp/redis/commit/32350df84e85a369b3123398fd5dcf17f4af030b now.
it seems blocking. can we have a non-blocking example?
foreach ($subscription as $message) {
echo "Got " . $message . " on " . date('Y-m-d H:i:s') . "\n";
__handle($message);
}
function __handle($msg) {
sleep(30);
return;
}
can use function Amp\ParallelFunctions\parallelMap;? basically we want to process the message as fast as possible.
Thanks
It is non-blocking using Fibers, otherwise the example would block at the foreach and never run the async block. delay() is the non-blocking sleep equivalent.
anything wrong? I'm new to amphp
it exited immediately.
Thanks