laravel-swoole icon indicating copy to clipboard operation
laravel-swoole copied to clipboard

Add event swoole.beforeStart to be able to bind server events

Open netdown opened this issue 4 years ago • 4 comments

Currently, there is no way to bind events on the server instance, as there is no way to retrieve it in a 'created, but not started yet' state. Therefore I added dispatching of swoole.beforeStart event.

netdown avatar Nov 09 '20 13:11 netdown

Confirmed that this change creates errors. I am totally confused about the reason. I was able to find another way to reach my goal, but would really appreciate an explanation. In my case, this resulted the container being null in multiple places after this call (manager, concerns).

netdown avatar Nov 10 '20 09:11 netdown

which places you've got null?

Arkanius avatar Nov 10 '20 14:11 Arkanius

I was unable to reproduce. I'm almost sure that it was onRequest function (in manager): $this->app->make('events')->dispatch('swoole.request') line, the error was app being null. But you can find similar errors in the Travis CI log.

netdown avatar Nov 11 '20 20:11 netdown

Ok, I'll run some tests here and try to understand it. I changed your PR to WIP in order to avoid other issues

Arkanius avatar Nov 12 '20 02:11 Arkanius