|
@@ -71,16 +71,10 @@ module.exports = DocumentUpdaterController =
|
|
|
seen[client.id] = true
|
|
seen[client.id] = true
|
|
|
if client.id == update.meta.source
|
|
if client.id == update.meta.source
|
|
|
logger.log doc_id: doc_id, version: update.v, source: update.meta?.source, "distributing update to sender"
|
|
logger.log doc_id: doc_id, version: update.v, source: update.meta?.source, "distributing update to sender"
|
|
|
- try
|
|
|
|
|
- client.emit "otUpdateApplied", v: update.v, doc: update.doc
|
|
|
|
|
- catch err
|
|
|
|
|
- logger.warn client_id: client.id, doc_id: doc_id, err: err, "error sending update to sender"
|
|
|
|
|
|
|
+ client.emit "otUpdateApplied", v: update.v, doc: update.doc
|
|
|
else if !update.dup # Duplicate ops should just be sent back to sending client for acknowledgement
|
|
else if !update.dup # Duplicate ops should just be sent back to sending client for acknowledgement
|
|
|
logger.log doc_id: doc_id, version: update.v, source: update.meta?.source, client_id: client.id, "distributing update to collaborator"
|
|
logger.log doc_id: doc_id, version: update.v, source: update.meta?.source, client_id: client.id, "distributing update to collaborator"
|
|
|
- try
|
|
|
|
|
- client.emit "otUpdateApplied", update
|
|
|
|
|
- catch err
|
|
|
|
|
- logger.warn client_id: client.id, doc_id: doc_id, err: err, "error sending update to collaborator"
|
|
|
|
|
|
|
+ client.emit "otUpdateApplied", update
|
|
|
if Object.keys(seen).length < clientList.length
|
|
if Object.keys(seen).length < clientList.length
|
|
|
metrics.inc "socket-io.duplicate-clients", 0.1
|
|
metrics.inc "socket-io.duplicate-clients", 0.1
|
|
|
logger.log doc_id: doc_id, socketIoClients: (client.id for client in clientList), "discarded duplicate clients"
|
|
logger.log doc_id: doc_id, socketIoClients: (client.id for client in clientList), "discarded duplicate clients"
|
|
@@ -88,10 +82,7 @@ module.exports = DocumentUpdaterController =
|
|
|
_processErrorFromDocumentUpdater: (io, doc_id, error, message) ->
|
|
_processErrorFromDocumentUpdater: (io, doc_id, error, message) ->
|
|
|
for client in io.sockets.clients(doc_id)
|
|
for client in io.sockets.clients(doc_id)
|
|
|
logger.warn err: error, doc_id: doc_id, client_id: client.id, "error from document updater, disconnecting client"
|
|
logger.warn err: error, doc_id: doc_id, client_id: client.id, "error from document updater, disconnecting client"
|
|
|
- try
|
|
|
|
|
- client.emit "otUpdateError", error, message
|
|
|
|
|
- client.disconnect()
|
|
|
|
|
- catch err
|
|
|
|
|
- logger.warn client_id: client.id, doc_id: doc_id, err: err, cause: error, "error sending error to client"
|
|
|
|
|
|
|
+ client.emit "otUpdateError", error, message
|
|
|
|
|
+ client.disconnect()
|
|
|
|
|
|
|
|
|
|
|