UNPKG

redis-smq

Version:

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

20 lines 837 B
import { redisKeys } from '../../../redis/redis-keys/redis-keys.js'; import { withSharedPoolConnection } from '../../../redis/redis-connection-pool/with-shared-pool-connection.js'; import { BackgroundJobWorkerNotFoundError } from '../../../../errors/index.js'; export function _getBackgroundJobWorker(jobId, cb) { const { keyJobWorker } = redisKeys.getJobKeys(jobId); withSharedPoolConnection((client, cb) => { client.get(keyJobWorker, (err, workerId) => { if (err) return cb(err); if (!workerId) return cb(new BackgroundJobWorkerNotFoundError({ metadata: { jobId, }, })); cb(null, workerId); }); }, cb); } //# sourceMappingURL=_get-background-job-worker.js.map