@vendure/job-queue-plugin
Advanced tools
Comparing version 1.3.0-beta.1 to 1.3.0
{ | ||
"name": "@vendure/job-queue-plugin", | ||
"version": "1.3.0-beta.1", | ||
"version": "1.3.0", | ||
"license": "MIT", | ||
@@ -27,4 +27,4 @@ "main": "package/index.js", | ||
"@types/redis": "^2.8.28", | ||
"@vendure/common": "^1.3.0-beta.1", | ||
"@vendure/core": "^1.3.0-beta.1", | ||
"@vendure/common": "^1.3.0", | ||
"@vendure/core": "^1.3.0", | ||
"bullmq": "^1.40.1", | ||
@@ -35,3 +35,3 @@ "redis": "^3.0.2", | ||
}, | ||
"gitHead": "e268234ffbbca155c7175cb0d7198f52b47c5707" | ||
"gitHead": "ac851bb030d281e3fc31078d2e9d61620eae5b29" | ||
} |
@@ -15,2 +15,3 @@ import { Injector, Job, JobBufferStorageStrategy } from '@vendure/core'; | ||
private toJob; | ||
private getAllBufferIds; | ||
} |
@@ -45,2 +45,3 @@ "use strict"; | ||
async bufferSize(bufferIds) { | ||
const ids = (bufferIds === null || bufferIds === void 0 ? void 0 : bufferIds.length) ? bufferIds : await this.getAllBufferIds(); | ||
const result = {}; | ||
@@ -55,2 +56,3 @@ for (const id of bufferIds || []) { | ||
async flush(bufferIds) { | ||
const ids = (bufferIds === null || bufferIds === void 0 ? void 0 : bufferIds.length) ? bufferIds : await this.getAllBufferIds(); | ||
const result = {}; | ||
@@ -83,4 +85,16 @@ for (const id of bufferIds || []) { | ||
} | ||
async getAllBufferIds() { | ||
const stream = this.redis.scanStream({ | ||
match: `${BUFFER_LIST_PREFIX}:*`, | ||
}); | ||
const keys = await new Promise((resolve, reject) => { | ||
const allKeys = []; | ||
stream.on('data', _keys => allKeys.push(..._keys)); | ||
stream.on('end', () => resolve(allKeys)); | ||
stream.on('error', err => reject(err)); | ||
}); | ||
return keys.map(key => key.replace(`${BUFFER_LIST_PREFIX}:`, '')); | ||
} | ||
} | ||
exports.RedisJobBufferStorageStrategy = RedisJobBufferStorageStrategy; | ||
//# sourceMappingURL=redis-job-buffer-storage-strategy.js.map |
@@ -50,2 +50,15 @@ import { Job } from '@vendure/core'; | ||
* | ||
* @example | ||
* ```TypeScript | ||
* setRetries: (queueName, job) => { | ||
* if (queueName === 'send-email') { | ||
* // Override the default number of retries | ||
* // for the 'send-email' job because we have | ||
* // a very unreliable email service. | ||
* return 10; | ||
* } | ||
* return job.retries; | ||
* } | ||
* ``` | ||
* | ||
* @since 1.3.0 | ||
@@ -52,0 +65,0 @@ */ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
68035
1079
0