schedule-bundle
schedule-bundle copied to clipboard
Multiple CommandTask memory issue
I have found when multiple CommandTask
's are due at the same time it can hit your PHP memory limit. I'm not sure what the best way to combat this is. Maybe running tasks in another process somehow?
There are two workarounds I have found:
-
Wrap the commands in a process:
# instead of - task: my:command # use - task: 'bash:bin/console my:command'
This works but removes the ability to catch exceptions (task will still fail if an exception in the command is thrown).
Also, your environment isn't passed to the command automatically like when running an actual
CommandTask
. You would need to pass it as an argument:- task: 'bash:bin/console my:command --env=prod'
-
Ensure
CommandTask
's do not run at the same time. Even one minute difference in frequency solves the issue. The cron hash expressions can help with this. If using aCompoundTask
to ensure tasks run in a specific order this gets more complex, you need split up theCompoundTask
and schedule the tasks after each other giving enough time for the previous to complete.
Hi Kevin I am not that good of a programmer but if I can test something or think with you no problem
Thanks Paul, I don't have any ideas that don't require breaking architecture changes. I plan to revisit for 2.0.
I think the workarounds described above solve the problem but if you run into it and they don't, let me know!