From abdb4c34effa1786664c0323916b6fcaff3b591d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 25 Nov 2013 17:49:17 -0500 Subject: [PATCH] tweaks to topic locking --- src/threadTools.js | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/threadTools.js b/src/threadTools.js index 3bce5d62a7..794a15f8ad 100644 --- a/src/threadTools.js +++ b/src/threadTools.js @@ -56,10 +56,12 @@ var RDB = require('./redis.js'), status: 'ok' }); - socket.emit('api:topic.lock', { - status: 'ok', - tid: tid - }); + if (socket) { + socket.emit('api:topic.lock', { + status: 'ok', + tid: tid + }); + } } } @@ -72,10 +74,12 @@ var RDB = require('./redis.js'), status: 'ok' }); - socket.emit('api:topic.unlock', { - status: 'ok', - tid: tid - }); + if (socket) { + socket.emit('api:topic.unlock', { + status: 'ok', + tid: tid + }); + } } } @@ -129,10 +133,12 @@ var RDB = require('./redis.js'), status: 'ok' }); - socket.emit('api:topic.pin', { - status: 'ok', - tid: tid - }); + if (socket) { + socket.emit('api:topic.pin', { + status: 'ok', + tid: tid + }); + } } } @@ -147,10 +153,12 @@ var RDB = require('./redis.js'), status: 'ok' }); - socket.emit('api:topic.unpin', { - status: 'ok', - tid: tid - }); + if (socket) { + socket.emit('api:topic.unpin', { + status: 'ok', + tid: tid + }); + } } }