@abtnode/queue 1.17.6 → 1.17.7-beta-20251224-045844-3c7f459a
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 +10 -1
- package/lib/store/sequelize.js +2 -0
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const tryWithTimeout = require('@abtnode/util/lib/try-with-timeout');
|
|
|
7
7
|
const sleep = require('@abtnode/util/lib/sleep');
|
|
8
8
|
|
|
9
9
|
const NedbStore = require('./store/nedb');
|
|
10
|
-
const
|
|
10
|
+
const defaultLogger = require('./logger');
|
|
11
11
|
|
|
12
12
|
const CANCELLED = '__CANCELLED__';
|
|
13
13
|
const MIN_DELAY = process.env.NODE_ENV === 'test' ? 2 : 5;
|
|
@@ -36,6 +36,15 @@ const MIN_DELAY = process.env.NODE_ENV === 'test' ? 2 : 5;
|
|
|
36
36
|
* @param {boolean} [config.options.enableScheduledJob] [param=false] enable scheduled job or not, default is false
|
|
37
37
|
*/
|
|
38
38
|
module.exports = function createQueue({ file, store, onJob, options = {} }) {
|
|
39
|
+
const requiredMethods = ['error', 'warn', 'info', 'debug', 'verbose', 'silly'];
|
|
40
|
+
const logger = requiredMethods.reduce((acc, method) => {
|
|
41
|
+
acc[method] =
|
|
42
|
+
options.logger?.[method] && typeof options.logger[method] === 'function'
|
|
43
|
+
? (...args) => options.logger[method](...args)
|
|
44
|
+
: defaultLogger[method];
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
|
|
39
48
|
if (!file && !store) {
|
|
40
49
|
throw new Error('Either nedb file path or store instance must be provided to create a queue');
|
|
41
50
|
}
|
package/lib/store/sequelize.js
CHANGED
|
@@ -125,10 +125,12 @@ class SequelizeStore {
|
|
|
125
125
|
if (exist) {
|
|
126
126
|
throw new CustomError('JOB_DUPLICATE', `Job ${id} already exist`);
|
|
127
127
|
}
|
|
128
|
+
const entityId = job.teamDid || job.did || job.entityId || job.appDid || '';
|
|
128
129
|
return this.db.insert({
|
|
129
130
|
id,
|
|
130
131
|
job,
|
|
131
132
|
queue: this.queue,
|
|
133
|
+
entityId,
|
|
132
134
|
retryCount: 1,
|
|
133
135
|
cancelled: false,
|
|
134
136
|
processingBy: null,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.
|
|
6
|
+
"version": "1.17.7-beta-20251224-045844-3c7f459a",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "e30dc1736187fc9d8136f146badfd5b521af16f2",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/db": "1.17.
|
|
22
|
-
"@abtnode/util": "1.17.
|
|
21
|
+
"@abtnode/db": "1.17.7-beta-20251224-045844-3c7f459a",
|
|
22
|
+
"@abtnode/util": "1.17.7-beta-20251224-045844-3c7f459a",
|
|
23
23
|
"@blocklet/error": "^0.3.5",
|
|
24
24
|
"debug": "^4.4.1",
|
|
25
25
|
"fastq": "^1.17.1",
|
|
26
26
|
"uuid": "^11.1.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@abtnode/models": "1.17.
|
|
29
|
+
"@abtnode/models": "1.17.7-beta-20251224-045844-3c7f459a"
|
|
30
30
|
}
|
|
31
31
|
}
|