@rpcbase/server 0.174.0 → 0.175.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/queue/dispatch_queue.js +5 -1
- package/queue/index.js +3 -1
package/package.json
CHANGED
package/queue/dispatch_queue.js
CHANGED
|
@@ -18,7 +18,11 @@ const dispatch_queue = (queue, model_name, op, doc) => {
|
|
|
18
18
|
|
|
19
19
|
// console.log("handler_name", handler_name)
|
|
20
20
|
|
|
21
|
-
queue.add(handler_name, {doc}
|
|
21
|
+
queue.add(handler_name, {doc}, {
|
|
22
|
+
jobId: `${op}-${doc._id}`,
|
|
23
|
+
removeOnComplete: true,
|
|
24
|
+
removeOnFail: true,
|
|
25
|
+
})
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
|
package/queue/index.js
CHANGED
|
@@ -48,7 +48,9 @@ const start_worker = async() => {
|
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
// processor function
|
|
51
|
-
|
|
51
|
+
// default concurrency is 2, in practice we will implement this with multiple workers
|
|
52
|
+
// to take advantage of multi cpu machines
|
|
53
|
+
worker_queue.process(2, async(job) => {
|
|
52
54
|
try {
|
|
53
55
|
const {task_name, payload} = job.data
|
|
54
56
|
|