How to properly stop worker on error #1899
-
I want to ask, how to properly stop worker on error? In documentation https://docs.roadrunner.dev/php-worker/developer#stop-command there is example, where method
Should i use return after stop command or not? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @VojtechBuba 👋 |
Beta Was this translation helpful? Give feedback.
Hey @VojtechBuba 👋
You may just exit the
while
loop.Continue needed to properly handle the internal signal from RR to gracefully stop that worker. After you send a stop, RR sends a SIGINT to the worker. So, if the worker is already dead (you used a return), RR will spam you an additional log, that it can't gracefully stop that worker. So, that is up to you. Anyway, RR will recreate the worker without any problems.