import faktory, { Job, Worker } from 'faktory-worker'
const worker = new Worker()
//Conditional value as an example. In our use case this boolean is determined elsewhere.
let condition = false
async function workerFunc(data) {
//Some condition we want to quiet for...
if (condition) {
worker.quiet()
setTimeout(() => {
condition = false
worker.work() //Does not set quieted to false
}, 1000 * 60)
} else {
//Actual job work goes here
condition = true
}
}
function startWorker() {
worker.register('JobType', workerFunc)
worker.work()
}
startWorker()
Expected Behavior:
After the worker quiet period is over, calling worker.work() should flip the bit on the Worker.quieted boolean value so the worker actually continues to process jobs again.
Actual Behavior:
When calling worker.work() the Worker.quieted value remains set to true
Steps to reproduce the behavior or a test case:
Run the above referenced code, and/or attempt to quiet your worker and see that calling work never resumes job handling.
I'd be happy to open a PR for this. I manually edited the worker.js file like this to "fix" things.
node.js version: 18.15.0
npm/yarn version: 1.22.21
faktory-server version: 1.9.0
facktory-worker
package version: 4.5.1Code sample:
Expected Behavior:
After the worker quiet period is over, calling
worker.work()
should flip the bit on the Worker.quieted boolean value so the worker actually continues to process jobs again.Actual Behavior:
When calling
worker.work()
the Worker.quieted value remains set totrue
Steps to reproduce the behavior or a test case:
Run the above referenced code, and/or attempt to quiet your worker and see that calling work never resumes job handling.
I'd be happy to open a PR for this. I manually edited the
worker.js
file like this to "fix" things.