Automattic / Automattic/kue

Prevent duplicate jobs

Open
#1,033 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.4k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

To avoid triggering more work than is needed, I'd like to be able to prevent dup jobs.
I've heard suggestions in other issues to record and check existing Job Ids, and then not create the job, but this isn't practical.

Conceptually, it seems like the solution is to let consumers provide a Job ID when enqueueing a job:

```js
var kue = require('kue')
, queue = kue.createQueue();

var dedupedJob = queue.create('trimList', { arg: 'xxx' }, { id: 'myUniqIdentifier_whichWillPreventDupsUntilProcessed' });
dedupedJob.save();
```

See: #1034

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the queue.create enqueue path shown in the issue and review the related discussion in #1034. Determine how a consumer-supplied Job ID should prevent duplicate creation until the existing job is processed; done means the proposed API behavior is implemented and covered by appropriate queue tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, redis
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.