exaco / laravel-octane-dockerfile

Production-ready Dockerfile for Laravel Octane (FrankenPHP, Swoole, RoadRunner) powered web services and microservices. Done right.
MIT License
580 stars 88 forks source link

Scheduler issues - can't run overlapping tasks #49

Closed varemel closed 8 months ago

varemel commented 8 months ago

Thanks for your work.

Faced 2 issues regarding Laravel scheduler:

  1. Can't run more than 1 job simultaneously. Reason is lack of -overlappingflag in supercronic start command (https://github.com/aptible/supercronic#duplicate-jobs).

Suggest to add this flag in supervisord.app.conf

[program:scheduler]
...
command=supercronic -overlapping /etc/supercronic/laravel
...
  1. Need to clear jobs mutexes in case of container restart.

Suggest to add to supervisord.app.conf one time process with autorestart=false

[program:clear-scheduler-cache]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan schedule:clear-cache
user=%(ENV_NON_ROOT_USER)s
autostart=%(ENV_APP_WITH_SCHEDULER)s
autorestart=false
stdout_logfile=/var/www/html/scheduler.log
smortexa commented 8 months ago

Thanks for your suggestions, and I'm happy to say I've implemented them.