laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
942 stars 63 forks source link

[1.x] Prevents blocking event loop #195

Closed l3aro closed 1 month ago

l3aro commented 2 months ago

ReactPHP runs in one thread and can't be interrupted. So, when we have some blocking stuff inside one of the handlers, for example connection to Redis not stable, or turn on xDebug make garbage collector slower than usual, the whole loop is blocked, and all other handlers will be delayed!

joedixon commented 2 months ago

Hey @l3aro thanks for the suggestion. The PR looks good, I just want to find some time to give it a full test at some decent scale and will report back when I've had the opportunity to do so.

joedixon commented 1 month ago

Tested and working great. Nice addtion, thank you!

ging-dev commented 1 month ago

@l3aro @joedixon async(callable():(PromiseInterface<T>|T) $function): (callable():PromiseInterface<T>) only makes sense if the callback uses the await(PromiseInterface<T> $promise): T. See: https://github.com/reactphp/async?tab=readme-ov-file#async. Looks like this commit uses async() incorrectly.