@abtnode/queue 1.16.17-beta-6f0c7674 → 1.16.17-beta-703fb879
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/lib/index.js +16 -1
- package/package.json +4 -4
package/lib/index.js
CHANGED
|
@@ -12,6 +12,15 @@ const logger = require('./logger');
|
|
|
12
12
|
const CANCELLED = '__CANCELLED__';
|
|
13
13
|
const MIN_DELAY = process.env.NODE_ENV === 'test' ? 2 : 5;
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {{
|
|
17
|
+
* entity: string,
|
|
18
|
+
* action?: string,
|
|
19
|
+
* blocklet: import('@abtnode/client').BlockletState,
|
|
20
|
+
* context: {},
|
|
21
|
+
* }} Job
|
|
22
|
+
*/
|
|
23
|
+
|
|
15
24
|
/**
|
|
16
25
|
*
|
|
17
26
|
* @param {Object} config
|
|
@@ -57,6 +66,12 @@ module.exports = function createQueue({ file, store, onJob, options = {} }) {
|
|
|
57
66
|
store = new NedbStore(file);
|
|
58
67
|
}
|
|
59
68
|
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param {string} jobId
|
|
72
|
+
* @param {Job} job
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
60
75
|
const getJobId = (jobId, job) =>
|
|
61
76
|
jobId || (typeof options.id === 'function' ? options.id(job) : uuid.v4()) || uuid.v4();
|
|
62
77
|
|
|
@@ -85,7 +100,7 @@ module.exports = function createQueue({ file, store, onJob, options = {} }) {
|
|
|
85
100
|
/**
|
|
86
101
|
* Push job to the queue, the old way of calling `push(job, jobId, persist)` will be deprecated
|
|
87
102
|
* @param {object} params
|
|
88
|
-
* @param {
|
|
103
|
+
* @param {Job} params.job The data of the job
|
|
89
104
|
* @param {string} params.jobId Optional, custom jobId
|
|
90
105
|
* @param {boolean} params.persist [persist=true] Persisting the job to the database
|
|
91
106
|
* @param {number} params.delay Optional, default with no delay, unit is second, for example: 10 will run after 10s
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.17-beta-
|
|
6
|
+
"version": "1.16.17-beta-703fb879",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/db": "1.16.17-beta-
|
|
23
|
-
"@abtnode/util": "1.16.17-beta-
|
|
22
|
+
"@abtnode/db": "1.16.17-beta-703fb879",
|
|
23
|
+
"@abtnode/util": "1.16.17-beta-703fb879",
|
|
24
24
|
"debug": "^4.3.4",
|
|
25
25
|
"fastq": "^1.13.0",
|
|
26
26
|
"uuid": "^8.3.2"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "97d63c671d823076e58b994107e10866367edd5d",
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"jest": "^27.5.1"
|
|
31
31
|
}
|