human fight sequence fix

This commit is contained in:
Dorian
2026-03-11 10:02:37 +00:00
parent 974566778e
commit 29a0a48eb1
3 changed files with 69 additions and 18 deletions
+1 -9
View File
@@ -454,14 +454,6 @@ fightsRouter.get('/:id/stream', (c) => {
})
})
const cleanupGlobal = fightEvents.onAll((event) => {
if (event.fightId === fightId && event.type === 'fight_end') {
void stream.writeSSE({
event: 'fight_end',
data: JSON.stringify({ ...event.data, spectators: spectatorCounts.get(fightId) || 0 }),
})
}
})
try {
while (true) {
@@ -495,7 +487,7 @@ fightsRouter.get('/:id/stream', (c) => {
spectatorCounts.set(fightId, current - 1)
}
cleanup()
cleanupGlobal()
}
})
})