UNPKG

redis-smq

Version:

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

16 lines 859 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withSharedPoolConnection = withSharedPoolConnection; const redis_smq_common_1 = require("redis-smq-common"); const redis_connection_pool_js_1 = require("./redis-connection-pool.js"); const connection_pool_js_1 = require("./types/connection-pool.js"); function withSharedPoolConnection(operation, callback) { const connectionPool = redis_connection_pool_js_1.RedisConnectionPool.getInstance(); redis_smq_common_1.async.withCallback((cb) => connectionPool.acquire(connection_pool_js_1.ERedisConnectionAcquisitionMode.SHARED, cb), (redisClient, cb) => { operation(redisClient, (err, result) => { connectionPool.release(redisClient); cb(err, result); }); }, callback); } //# sourceMappingURL=with-shared-pool-connection.js.map