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

Respond with 503 when app is not settled

Open m3m0r7 opened this issue 4 years ago • 2 comments

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:

2021-03-07_at_10_49_04 2021-03-07_at_10_49_21

m3m0r7 avatar Mar 07 '21 02:03 m3m0r7

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 avatar Mar 09 '21 12:03 Arkanius

@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.

m3m0r7 avatar Mar 09 '21 12:03 m3m0r7