[monorepo] clean up the per-project pub/sub migration (#35686)

GitOrigin-RevId: 4bbb97d1d2750f21751ef54e206e3e720b88615a
This commit is contained in:
Jakob Ackermann
2026-09-17 11:33:51 +00:00
committed by Copybot
parent 10adc3c477
commit bc9d25d385
8 changed files with 59 additions and 246 deletions
@@ -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'