prooph / event-store-symfony-bundle

Event Store Symfony Bundle

Home Page:http://getprooph.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a --time-limit option for event-store:projection:run command

ambroisemaupate opened this issue · comments

In production, bin/console event-store:projection:run command may be executed during a long time, we should be able to kill it after a given time in the same way Symfony Messenger consumers do to avoid PHP memory leaks. Then, using a process manager such as Supervisor to restart automatically worker

[program:eventstore-projection]
command=php /app/bin/console event-store:projection:run %(PROJECTION_NAME)s --time-limit=1800
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true

[supervisord]
nodaemon=true

https://github.com/symfony/messenger/blob/master/Command/ConsumeMessagesCommand.php#L79

https://github.com/symfony/messenger/blob/master/Worker/StopWhenTimeLimitIsReachedWorker.php