Try to solve realtime connection get stock when lots of client try to connect at same moment

This commit is contained in:
Cheng-Han, Wu 2016-06-17 16:32:33 +08:00
parent 6fddab1bfc
commit 614a97376d

View file

@ -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) {