mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[perf] WebsocketLoadBalancer: move back to a sync loop for msg fan out
This commit is contained in:
parent
a70c1e1fa2
commit
ce4f9148c3
1 changed files with 1 additions and 9 deletions
|
@ -7,7 +7,6 @@ HealthCheckManager = require "./HealthCheckManager"
|
||||||
RoomManager = require "./RoomManager"
|
RoomManager = require "./RoomManager"
|
||||||
ChannelManager = require "./ChannelManager"
|
ChannelManager = require "./ChannelManager"
|
||||||
ConnectedUsersManager = require "./ConnectedUsersManager"
|
ConnectedUsersManager = require "./ConnectedUsersManager"
|
||||||
Async = require 'async'
|
|
||||||
|
|
||||||
RESTRICTED_USER_MESSAGE_TYPE_PASS_LIST = [
|
RESTRICTED_USER_MESSAGE_TYPE_PASS_LIST = [
|
||||||
'connectionAccepted',
|
'connectionAccepted',
|
||||||
|
@ -96,17 +95,10 @@ module.exports = WebsocketLoadBalancer =
|
||||||
socketIoClients: (client.id for client in clientList)
|
socketIoClients: (client.id for client in clientList)
|
||||||
}, "distributing event to clients"
|
}, "distributing event to clients"
|
||||||
seen = {}
|
seen = {}
|
||||||
# Send the messages to clients async, don't wait for them all to finish
|
for client in clientList
|
||||||
Async.eachLimit clientList
|
|
||||||
, 2
|
|
||||||
, (client, cb) ->
|
|
||||||
if !seen[client.id]
|
if !seen[client.id]
|
||||||
seen[client.id] = true
|
seen[client.id] = true
|
||||||
client.emit(message.message, message.payload...)
|
client.emit(message.message, message.payload...)
|
||||||
cb()
|
|
||||||
, (err) ->
|
|
||||||
if err?
|
|
||||||
logger.err {err, message}, "Error sending message to clients"
|
|
||||||
else if message.health_check?
|
else if message.health_check?
|
||||||
logger.debug {message}, "got health check message in editor events channel"
|
logger.debug {message}, "got health check message in editor events channel"
|
||||||
HealthCheckManager.check channel, message.key
|
HealthCheckManager.check channel, message.key
|
||||||
|
|
Loading…
Reference in a new issue