From 614a97376dff04d06dae682a079da0ad3a6af76f Mon Sep 17 00:00:00 2001 From: Cheng-Han, Wu Date: Fri, 17 Jun 2016 16:32:33 +0800 Subject: Try to solve realtime connection get stock when lots of client try to connect at same moment --- lib/realtime.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/realtime.js b/lib/realtime.js index 8ed54437..5de3c565 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -329,7 +329,11 @@ var isDisconnectBusy = false; var disconnectSocketQueue = []; function finishConnection(socket, note, user) { - if (!socket || !note || !user) return; + if (!socket || !note || !user) { + connectionSocketQueue.pop(); + isConnectionBusy = false; + return; + } //check view permission if (note.permission == 'private') { if (socket.request.user && socket.request.user.logged_in && socket.request.user.id == note.owner) { -- cgit v1.2.3