From 584e48143014faaa6ef38ed715a5763000c0c2a6 Mon Sep 17 00:00:00 2001 From: Ray Bellis Date: Tue, 22 Jan 2019 15:48:29 +0000 Subject: [PATCH] PadMessageHandler.js: migrate to thenify --- src/node/handler/PadMessageHandler.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 2edd9390e..8fc43b156 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -61,7 +61,7 @@ stats.gauge('totalUsers', function() { /** * A changeset queue per pad that is processed by handleUserChanges() */ -var padChannels = new channels.channels(handleUserChanges); +var padChannels = new channels.channels(thenify(handleUserChanges)); /** * Saves the Socket class we need to send and receive data from the client @@ -330,7 +330,7 @@ function handleSaveRevisionMessage(client, message){ * @param msg {Object} the message we're sending * @param sessionID {string} the socketIO session to which we're sending this message */ -exports.handleCustomObjectMessage = function(msg, sessionID, cb) { +exports.handleCustomObjectMessage = thenify(function(msg, sessionID, cb) { if (msg.data.type === "CUSTOM") { if (sessionID){ // a sessionID is targeted: directly to this sessionID @@ -341,7 +341,8 @@ exports.handleCustomObjectMessage = function(msg, sessionID, cb) { } } cb(null, {}); -} +}); + /** * Handles a custom message (sent via HTTP API request) @@ -349,7 +350,7 @@ exports.handleCustomObjectMessage = function(msg, sessionID, cb) { * @param padID {Pad} the pad to which we're sending this message * @param msgString {String} the message we're sending */ -exports.handleCustomMessage = function(padID, msgString, cb) { +exports.handleCustomMessage = thenify(function(padID, msgString, cb) { var time = Date.now(); var msg = { type: 'COLLABROOM', @@ -361,7 +362,7 @@ exports.handleCustomMessage = function(padID, msgString, cb) { socketio.sockets.in(padID).json.send(msg); cb(null, {}); -} +}); /** * Handles a Chat Message