Automattic / Automattic/kue

How to organize producer/consumer in different modules?

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

I want to organize a producer of tasks in one module and consuming-workers in another module. So I need to create jobs in one place of code without waiting for their processing. And workers are waiting for new tasks to process them.

**producer.js**
`const queue = require(kue).createQueue()`
`queue.create('task').save()`
`// need to close connection. If queue.quit() or process.exit(0) — workers are not receiving their jobs`

**consumer.js**
`const queue = require(kue).createQueue()`
`queue.process('task', () => done())`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by examining producer.js and consumer.js together, focusing on queue creation, job saving, and connection shutdown. Reproduce the behavior with the producer and consumer in separate modules, then establish the expected connection lifecycle and confirm that jobs remain available to the worker after the producer exits.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.