Skip to content

Commit cb36364

Browse files
committed
fix acquiredb to return promise
1 parent 6557035 commit cb36364

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/redis_pool.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ function RedisPool (name, redisOptions, poolOptions) {
6161
return _pool.acquire(priority);
6262
};
6363

64-
this.acquireDb = (cb, db, priority) => {
65-
_pool.acquire((err, client) => {
66-
if (!err && client._db_selected !== db) {
67-
client["_db_selected"] = db;
68-
client.select(db);
69-
}
70-
debug("DB selected: ", client._db_selected);
71-
72-
return cb(err, client);
73-
}, priority);
64+
this.acquireDb = (db, priority) => {
65+
return _pool.acquire(priority)
66+
.then(client => {
67+
if (client._db_selected !== db) {
68+
client["_db_selected"] = db;
69+
client.select(db);
70+
}
71+
debug("DB selected: ", client._db_selected);
72+
});
7473
};
7574

7675
// Release a database connection to the pool.

0 commit comments

Comments
 (0)