You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Bugs fixed:
* authentication retry while server is loading db (danmaz74) [GH-101] * command arguments processing issue with arrays New features: * Auto update of new commands from redis.io (Dave Hoover) * Performance improvements and backpressure controls. * Commands now return the true/false value from the underlying socket write(s). * Implement command_queue high water and low water for more better control of queueing. See `examples/backpressure_drain.js` for more information.
This commit is contained in:
33
examples/backpressure_drain.js
Normal file
33
examples/backpressure_drain.js
Normal file
@@ -0,0 +1,33 @@
|
||||
var redis = require("../index"),
|
||||
client = redis.createClient(null, null, {
|
||||
command_queue_high_water: 5,
|
||||
command_queue_low_water: 1
|
||||
}),
|
||||
remaining_ops = 10000, paused = false;
|
||||
|
||||
function op() {
|
||||
if (remaining_ops <= 0) {
|
||||
console.error("Finished.");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
remaining_ops--;
|
||||
if (client.hset("test hash", "val " + remaining_ops, remaining_ops) === false) {
|
||||
console.log("Pausing at " + remaining_ops);
|
||||
paused = true;
|
||||
} else {
|
||||
process.nextTick(op);
|
||||
}
|
||||
}
|
||||
|
||||
client.on("drain", function () {
|
||||
if (paused) {
|
||||
console.log("Resuming at " + remaining_ops);
|
||||
paused = false;
|
||||
process.nextTick(op);
|
||||
} else {
|
||||
console.log("Got drain while not paused at " + remaining_ops);
|
||||
}
|
||||
});
|
||||
|
||||
op();
|
Reference in New Issue
Block a user