- Issue created by @Kingdutch
With π Add revoltphp/event-loop dependency to core Active we enable core and contrib developers to easily kick-off asynchronous tasks. In a lot of use-cases (e.g. BigPipe) where the request code waits for the tasks that were kicked-off to be completed this doesn't matter because the tasks are shorter than the request. However it is also possible to kick-off tasks (e.g. search engine indexing) where the result is not important for the current request.
In the case that the tasks take longer to complete than it takes to send the response for a request and to terminate the kernel, in the current Drupal implementation, the tasks may get discarded as the request process exits.
To demonstrate this and other Revolt related things I've created a Revolt Playground repository on GitHub. For this problem compare the two examples in the Bootstrap demo.
Add EventLoop::run()
to the end of the index.php
file so that async tasks that were started but not yet completed before we get to that line have the opportunity to complete.
This placement is under the assumption that $kernel->terminate($request, $response);
does not throw away any data that these asynchronous tasks may need.
This is postponed on π Add revoltphp/event-loop dependency to core Active
EventLoop::run
or optionally provide a way for async tasks to signal they need to complete before $kernel->terminate($request, $response);
and provide a synchronisation point in Drupal coreActive
11.0 π₯
Last updated