How to handle long running schedule tasks with Schedule check #134
Unanswered
superbiche
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there,
I'm using both this package and laravel-schedule-monitor, both plugged to Oh Dear!. There is some fine-tuning left to do, but otherwise I'm loving it, so thanks.
There's one caveat though: in the docs docs, it's recommended to run the hearthbeat after all scheduled tasks:
https://spatie.be/docs/laravel-health/v1/available-checks/schedule
The issue is we have some long running tasks (5/10 minutes) that lead to a lot of false positives alerts ("The last schedule run was X minutes ago). I don't want to raise even more
heartbeatMaxAgeInMinutes
as the long running tasks don't run often.I have a few options in mind, but none seems to be the silver bullet, so any advice would be much appreciated:
Move the long running task to an external job (it's deployed on Kubernetes, so making a CronJob is quite easy).
Pro : schedules don't run long tasks anymore, the heartbeat is sent quickly
Con: we lose all monitoring capabilities from laravel-schedule-monitor
Move the heartbeat task before the long running tasks
Pro: heartbeat is sent quickly, no CronJobs to maintain
Con: heartbeat doesn't mean all commands ran successfully (but with laravel-schedule-monitor the subsequent commands are monitored, so this should not be an issue, huh?). Also seems like a pain to place the heartbeat accordingly and ask our team to be careful where they write new tasks in the console Kernel.
That's pretty much it. Any thoughts ?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions