mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[monorepo] clean up the per-project pub/sub migration (#35686)
GitOrigin-RevId: 4bbb97d1d2750f21751ef54e206e3e720b88615a
This commit is contained in:
@@ -26,12 +26,6 @@ const RESTRICTED_USER_MESSAGE_TYPE_PASS_LIST = [
|
||||
'toggle-track-changes',
|
||||
'projectRenamedOrDeletedByExternalSource',
|
||||
]
|
||||
const BANDWIDTH_BUCKETS = [0]
|
||||
// 64 bytes ... 8MB
|
||||
for (let i = 5; i <= 22; i++) {
|
||||
BANDWIDTH_BUCKETS.push(2 << i)
|
||||
}
|
||||
|
||||
let WebsocketLoadBalancer
|
||||
|
||||
export default WebsocketLoadBalancer = {
|
||||
@@ -147,31 +141,6 @@ export default WebsocketLoadBalancer = {
|
||||
for (const client of clientList) {
|
||||
ConnectedUsersManager.refreshClient(message.room_id, client.publicId)
|
||||
}
|
||||
} else if (message.message === 'canary-applied-op') {
|
||||
const { ack, broadcast, source, projectId, docId } = message.payload
|
||||
|
||||
const estimateBandwidth = (room, path) => {
|
||||
const seen = new Set()
|
||||
for (const client of io.sockets.clients(room)) {
|
||||
if (seen.has(client.id)) continue
|
||||
seen.add(client.id)
|
||||
let v = client.id === source ? ack : broadcast
|
||||
if (v === 0) {
|
||||
// Acknowledgements with update.dup===true will not get sent to other clients.
|
||||
continue
|
||||
}
|
||||
v += `5:::{"name":"otUpdateApplied","args":[]}`.length
|
||||
Metrics.histogram(
|
||||
'estimated-applied-ops-bandwidth',
|
||||
v,
|
||||
BANDWIDTH_BUCKETS,
|
||||
{ path }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
estimateBandwidth(projectId, 'per-project')
|
||||
estimateBandwidth(docId, 'per-doc')
|
||||
} else if (
|
||||
message.message === 'otUpdateApplied' ||
|
||||
message.message === 'otUpdateError'
|
||||
|
||||
Reference in New Issue
Block a user