-
Notifications
You must be signed in to change notification settings - Fork 367
Description
Describe you feature request
Is your feature request related to a problem? Please describe.
There are some known issues with connecting to the database #290, #233, #438, and there may be other reasons to limit the web server's runtime
Describe the solution you'd like
How about implementing the ability to automatically restart the web server when certain limits are reached? A similar feature is supported in Symfony Messenger:
Don't Let Workers Run Forever
Some services (like Doctrine's EntityManager) will consume more memory over time. So, instead of allowing your worker to run forever, use a flag like messenger:consume --limit=10 to tell your worker to only handle 10 messages before exiting (then the process manager will create a new process). There are also other options like --memory-limit=128M and --time-limit=3600.
Stopping Workers That Encounter Errors
If a worker dependency like your database server is down, or timeout is reached, you can try to add reconnect logic, or just quit the worker if it receives too many errors with the --failure-limit option of the messenger:consume command.
https://symfony.com/doc/current/messenger.html#deploying-to-production
This way it would be possible to set up several containers using Docker Swarm (for example) and achieve uninterrupted operation of the web server