fix memory leak
parent
f5864ef78e
commit
09a4c02312
|
@ -2,3 +2,4 @@
|
|||
node_modules/
|
||||
npm-debug.log
|
||||
config.json
|
||||
dist/
|
12
gulpfile.js
12
gulpfile.js
|
@ -3,6 +3,7 @@ var coffeelint = require('gulp-coffeelint');
|
|||
var nodemon = require('gulp-nodemon');
|
||||
var plumber = require("gulp-plumber");
|
||||
var cache = require("gulp-cache");
|
||||
var coffee = require("gulp-coffee");
|
||||
|
||||
gulp.task('lint', function () {
|
||||
gulp.src(['**/*.coffee', '!node_modules/**/*'])
|
||||
|
@ -19,6 +20,17 @@ gulp.task('lint', function () {
|
|||
.pipe(coffeelint.reporter());
|
||||
});
|
||||
|
||||
gulp.task('config', function() {
|
||||
return gulp.src('config.json')
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
gulp.task("coffee", ['config'], function() {
|
||||
return gulp.src("*.coffee")
|
||||
.pipe(coffee())
|
||||
.pipe(gulp.dest("dist/"));
|
||||
});
|
||||
|
||||
gulp.task('develop', function () {
|
||||
nodemon({ script: 'index.coffee'})
|
||||
.on('change', ['lint']);
|
||||
|
|
|
@ -18,15 +18,16 @@
|
|||
"devDependencies": {
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-cache": "^0.3.0",
|
||||
"gulp-coffee": "^2.3.3",
|
||||
"gulp-coffeelint": "^0.5.0",
|
||||
"gulp-nodemon": "^2.0.4",
|
||||
"gulp-plumber": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"amqplib": "^0.4.1",
|
||||
"amqplib": "^0.5.1",
|
||||
"base64-url": "^1.2.1",
|
||||
"bluebird": "^2.9.10",
|
||||
"node-uuid": "^1.4.2",
|
||||
"ws": "^1.1.1"
|
||||
"ws": "^2.0.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,6 @@ channels = do ->
|
|||
return pendingChannels[client_id]
|
||||
|
||||
pendingChannels[client_id] = new Promise (resolve, reject) ->
|
||||
delete pendingChannels[client_id]
|
||||
|
||||
if !chs[client_id]
|
||||
getConnection()
|
||||
.then (connection) -> connection.createChannel()
|
||||
|
@ -63,7 +61,10 @@ channels = do ->
|
|||
else
|
||||
resolve(chs[client_id])
|
||||
|
||||
return pendingChannels[client_id]
|
||||
return pendingChannels[client_id].then (ch) ->
|
||||
delete pendingChannels[client_id]
|
||||
|
||||
return ch
|
||||
|
||||
return {
|
||||
removeClient: removeClient
|
||||
|
|
Loading…
Reference in New Issue