@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.174.0",
3
+ "version": "0.175.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -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
- worker_queue.process(async(job) => {
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