fastify-queue
Advanced tools
Comparing version
@@ -20,7 +20,7 @@ "use strict"; | ||
files.forEach(function (filePath) { return (0, tslib_1.__awaiter)(void 0, void 0, void 0, function () { | ||
var parts, queueName, worker_1, queueConfig, workerConfig, error_1; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
switch (_a.label) { | ||
var parts, queueName, _a, worker_1, queueConfig, workerConfig, error_1; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
_b.trys.push([0, 2, , 3]); | ||
parts = filePath.split('/'); | ||
@@ -30,14 +30,12 @@ queueName = parts[parts.length - 2]; | ||
case 1: | ||
worker_1 = _a.sent(); | ||
queueConfig = worker_1.queueConfig; | ||
workerConfig = worker_1.workerConfig; | ||
_a = _b.sent(), worker_1 = _a["default"], queueConfig = _a.queueConfig, workerConfig = _a.workerConfig; | ||
queues[queueName] = new bullmq_1.Queue(queueName, (0, tslib_1.__assign)({ connection: opts.connection }, (queueConfig && queueConfig))); | ||
fastify.log.info("Created the queue ".concat(queueName)); | ||
if (worker_1["default"] && | ||
Object.keys(worker_1["default"]).length === 0 && | ||
worker_1["default"].constructor === Object) { | ||
if (worker_1 && | ||
Object.keys(worker_1).length === 0 && | ||
worker_1.constructor === Object) { | ||
fastify.log.warn("The queue ".concat(queueName, " does not have a worker function")); | ||
} | ||
else { | ||
workers[queueName] = new bullmq_1.Worker(queueName, function (job) { return worker_1["default"](fastify, job); }, (0, tslib_1.__assign)({ connection: opts.connection }, (workerConfig && workerConfig))); | ||
workers[queueName] = new bullmq_1.Worker(queueName, function (job) { return worker_1(fastify, job); }, (0, tslib_1.__assign)({ connection: opts.connection }, (workerConfig && workerConfig))); | ||
fastify.log.info("Created a worker for the queue ".concat(queueName)); | ||
@@ -47,3 +45,3 @@ } | ||
case 2: | ||
error_1 = _a.sent(); | ||
error_1 = _b.sent(); | ||
console.log('Cateched error', error_1); | ||
@@ -50,0 +48,0 @@ return [3 /*break*/, 3]; |
{ | ||
"name": "fastify-queue", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
10116
-1.68%65
-2.99%