UNPKG

redis-smq

Version:

A high-performance, reliable, and scalable message queue for Node.js.

23 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._getBackgroundJobWorker = _getBackgroundJobWorker; const redis_keys_js_1 = require("../../../redis/redis-keys/redis-keys.js"); const with_shared_pool_connection_js_1 = require("../../../redis/redis-connection-pool/with-shared-pool-connection.js"); const index_js_1 = require("../../../../errors/index.js"); function _getBackgroundJobWorker(jobId, cb) { const { keyJobWorker } = redis_keys_js_1.redisKeys.getJobKeys(jobId); (0, with_shared_pool_connection_js_1.withSharedPoolConnection)((client, cb) => { client.get(keyJobWorker, (err, workerId) => { if (err) return cb(err); if (!workerId) return cb(new index_js_1.BackgroundJobWorkerNotFoundError({ metadata: { jobId, }, })); cb(null, workerId); }); }, cb); } //# sourceMappingURL=_get-background-job-worker.js.map