redis-smq
Version:
A high-performance, reliable, and scalable message queue for Node.js.
13 lines • 649 B
JavaScript
import { async } from 'redis-smq-common';
import { RedisConnectionPool } from './redis-connection-pool.js';
import { ERedisConnectionAcquisitionMode } from './types/connection-pool.js';
export function withSharedPoolConnection(operation, callback) {
const connectionPool = RedisConnectionPool.getInstance();
async.withCallback((cb) => connectionPool.acquire(ERedisConnectionAcquisitionMode.SHARED, cb), (redisClient, cb) => {
operation(redisClient, (err, result) => {
connectionPool.release(redisClient);
cb(err, result);
});
}, callback);
}
//# sourceMappingURL=with-shared-pool-connection.js.map