laravel-swoole
laravel-swoole copied to clipboard
Respond with 503 when app is not settled
Hi! I caught errors when starting the server and refresh the page quickly.
The problem answer is different timing to start-up onRequest and onWorkerStart.
The bindToLaravelApp is not called by onWorkerStart when starting the server and access the page quickly.
Therefore, $app field is null for a certain period of time.
I caught errors are here:

Hi, thanks for your contribution!
I didn't get why you got this error after starting your swoole event loop.
Help me understand your case:
1 - did you run php artisan swoole:http start? 2 - after run this command, did you go to any route and got this error?
@Arkanius Thanks for your replying!
1 - did you run php artisan swoole:http start?
Yes, I did
after run this command, did you go to any route and got this error?
That is correct
I didn't get why you got this error after starting your swoole event loope.
Maybe, since the life cycle of onRequest and onWorkerStart are different, the errors are displayed when the connection is made before onWorkerStart is executed.
Because $app in the sandbox is null before Manager::bindToLaravelApp (actually bindSandbox) is running.