Laravel Horizon handling business logic double reporting on retried long running jobs #56653
Unanswered
sts-ryan-holton
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Do you really need long running jobs? Can't they be split up in multiple jobs? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋,
I was hoping to gain some insights from others on handling retried queued jobs in Horizon regarding to long running jobs that contain many HTTP requests and reporting logic.
Here's a scenario:
The problem:
When I want to deploy the project, I need to restart Horizon, (the
fast_termination
flag is already on) in order to get the new code onto the system. Since I've got thousands of leads coming in per hour, there's no ideal time to deploy.When I deploy, Horizon generates a new unique name for it:
Whilst the first part is customisable and linked to the machine's hostname, the second part is not
-0VOA
and is generated at random (it appears).This means that since the original Horizon where the job is processing is gone, and a new one boots, the job can be retried...
But, here's the problem:
$this->attempts()
but that's either a "yes/no", since I don't know where it got to in the job, I wouldn't know what business logic to re-increment.Final thoughts
I'm not sure how you're handling this kind of scenario in your project with queued jobs and what business logic you have in place.
Beta Was this translation helpful? Give feedback.
All reactions