Automattic / Automattic/kue

Communicate with job

Open
#1,243 0 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

Hey there,
Thanks for the amazing library!
I'm wondering if it is possible to communicate with a job after it was created.
In my specific example merely changing the data property would be sufficient.
I found out [how to do it](https://github.com/Automattic/kue/issues/505), but the change of the job is not reflected in the worker (I use clustering).
```
Job.get(rId, (err, job) => {
if (job) {
(job.data as QueueRenderPayloadData).shouldStop = true
}
})
```

I also tried to emit function:
Job.get(rId, (err, job) => {
if (job) {
const emitWorked = job.emit('customevent', { stop: true })
}
})

But emitWorked is always false, is there something to keep in mind when using clustering and emitting?

Thanks for your help!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the Job.get and job.emit entry points through the clustered worker flow, then inspect how Redis-backed job state and events cross processes. Done means identifying the supported communication behavior or defining a narrowly scoped change, with verification for clustered workers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, redis
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.