Skip to content

Always worker #320

Answered by brandur
nexovec asked this question in Q&A
Apr 22, 2024 · 8 comments · 3 replies
Discussion options

You must be logged in to vote

What you could do is combine periodic jobs with unique opts.

Configure a periodic job that inserts every five minutes or so, and set it to RunOnStart so that it always get an insert when a River client starts up.

Then, configure unique options by state [2], where JobStateCompleted is omitted so that if the job was ever finished, a new one gets inserted:

[]rivertype.JobState{
    rivertype.JobStateAvailable,
    rivertype.JobStateRunning,
    rivertype.JobStateRetryable,
    rivertype.JobStateScheduled,
}

The client will start up, insert an initial job, and that job will start work. The periodic job enqueuer will try to insert new versions of it every five minutes, but since the job is alr…

Replies: 8 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nexovec
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nexovec
Comment options

Comment options

You must be logged in to vote
1 reply
@bgentry
Comment options

Comment options

You must be logged in to vote
1 reply
@bgentry
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #316 on April 25, 2024 11:16.