Skip to content

Instantly share code, notes, and snippets.

@guileen
Created February 29, 2012 09:09
Show Gist options
  • Save guileen/1939341 to your computer and use it in GitHub Desktop.
Save guileen/1939341 to your computer and use it in GitHub Desktop.
This code will memory leak, if you restart redis server when the node process is running
/**
* This code will memory leak, if you restart redis server when the node process is running
*
* @author Gui Lin
*/
var redis = require('redis').createClient();
setInterval(function(){
redis.multi()
.zrangebyscore('timeup', 0, Date.now())
.zremrangebyscore('timeup', 0, Date.now())
.exec(function(err, data) {
if(err) console.log(err.stack);
if(data) data = data[0];
});
}, 1);
process.on('uncaughtException', function(err) {
console.log(err.stack);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment