1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

Protect connection retries from application exceptions

This commit is contained in:
Amos Barreto
2013-04-24 13:59:43 -07:00
parent aa50c789df
commit b30efac476

View File

@@ -118,7 +118,13 @@ RedisClient.prototype.flush_and_error = function (message) {
while (this.offline_queue.length > 0) {
command_obj = this.offline_queue.shift();
if (typeof command_obj.callback === "function") {
command_obj.callback(message);
try {
command_obj.callback(message);
} catch (callback_err) {
process.nextTick(function () {
throw callback_err;
});
}
}
}
this.offline_queue = new Queue();
@@ -126,7 +132,13 @@ RedisClient.prototype.flush_and_error = function (message) {
while (this.command_queue.length > 0) {
command_obj = this.command_queue.shift();
if (typeof command_obj.callback === "function") {
command_obj.callback(message);
try {
command_obj.callback(message);
} catch (callback_err) {
process.nextTick(function () {
throw callback_err;
});
}
}
}
this.command_queue = new Queue();