Occasionally bla::doWork() under test case 0 will send out a group of emails and and take a little time, and while ReactPHP provides async i/o, doWork() is blocking and prevents the other loops from triggering.
I came up with two other possible solutions under my test case 1 and 2. As another solution, thinking of using a redis/etc queue to dump the content to in this script and then have another script continuously run and process the data when it becomes available.
Any recommendation
Ideally you don't ever block if you have work to do. In general, as long as you can do work you should be doing work. It's when you cannot do any work that you want to yield control to the event loop. That's usually when you're waiting for I/O from somewhere.
That said, if the work you can do is going to take along time without having any sort of natural blocking point (I/O) but you don't want to block your other tasks for that long then you need to start trying to find ways you can brea