Support UniqueOpts without JobStateRunning in ByState
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by tracing the UniqueOpts and InsertOpts definitions and the JobStateRunning handling referenced in this request. Compare the existing uniqueness behavior with the requested pending-versus-running cases; done means insertion skips a duplicate pending job but permits one when the existing job is running, while preserving transactional behavior.
Written by the indexing model from the issue text.
Description
This is a followup to this issue and my comment here. I want to make a stand-alone feature request. So copying my comment here:
I am a newcomer to River, but explanation why JobStateRunning is required is surprising to me based on the rest of the documentation. UniqueOpts is part of InsertOpts and that to me means that it only controls when the job can be inserted, not how it can transition later on. For my use case (I described in https://github.com/riverqueue/river/issues/1178) I care that (transitionally) I can skip adding additional job if one is already pending, but not running. Jobs are designed so that they could run 100 of them in parallel, they are also idempotent, it is just that it is unnecessary to have more then one at any given time being scheduled to run.
About how many jobs are running in parallel, my understanding is that this is what concurrency limits are for, not insert options.
To me this is also surprising because when as a user I insert a job, it is never in any other state than an initial state. I cannot insert a job in the "running" state. That makes no sense. Only River can move job to a running state. So why would "InsertOps" control how can River move jobs between states? To me "InsertOps" is only about the user - can I as a user insert a job if any job is in a pending state but not yet running?
In fact, to me this is a feature: River should be able to transition any available job to running state. But if River does that, then my insertion (where "running" state is not among UniqueOpts) should transactionally succeed. And this is exactly the behavior I would need. If at any given moment job is not yet running or even not being started to be run, skip adding the job. It is unnecessary. The job which will shortly run will do the job. But if the job is already running, then schedule it. Because it might be that the job running will miss a bit of work.
- Dominant language
- Go
- Stars
- 5.9k
- Forks
- 197
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 120
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from riverqueue/river
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
riverqueue/river#1576 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
riverqueue/river#1258 · 7 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
riverqueue/river#1225 · 14 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
riverqueue/river#1185 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
riverqueue/river#1167 · 2 comments ·
Maintainers usually reply within 1 day
All issues in riverqueue/river
Similar issues
-
Routing rule or circuit breaker trip expression with an unknown CEL function hangs daprdPossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[falco-talon] Setting `podAnnotations` makes the chart fail to renderPossibly taken @RaphaelFakhri claimed this today. Openneeds-kind
Difficulty 1/5 Under an hour Newbie friendliness 88/100
falcosecurity/charts#1084 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
DataDog/terraform-provider-datadog#4479 ·
Maintainers usually reply within 2 days
-
component/tests needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
NVIDIA/nodewright#967 ·
Maintainers usually reply within 1 day