Skip to content

Instantly share code, notes, and snippets.

@umamialex
Last active August 29, 2015 14:19
Show Gist options
  • Save umamialex/1e6b7af24e13d491ec45 to your computer and use it in GitHub Desktop.
Save umamialex/1e6b7af24e13d491ec45 to your computer and use it in GitHub Desktop.
EventEmitter, Bluebird, Lodash Memory Test
{
"name": "eventemitter-bluebird-lodash-memory-test",
"version": "0.1.0",
"description": "A test for RSS memory growth using EventEmitter, Bluebird, and Lodash.",
"main": "server.js",
"dependencies": {
"bluebird": "^2.9.24",
"lodash": "^3.7.0",
"memory-logger": "git+https://gist.github.com/01d17e3280841c01d75e.git"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "Alexander Martin",
"license": "MIT"
}
var _ = require('lodash');
var Promise = require('bluebird');
var EventEmitter = require('events').EventEmitter;
var eventEmitter = new EventEmitter();
var testAsync = function testAsync() {
return new Promise(function(resolve, reject) {
setTimeout(_.partial(resolve, 'goodbye'), 100);
});
};
eventEmitter.on('test', function() { testAsync(); });
setInterval(function() {
eventEmitter.emit('test');
}, 10);
var memoryLogger = require('memory-logger');
memoryLogger.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment