fix(api): prevent SSE connection resource leak by checking stream.aborted

This commit is contained in:
yiling
2026-07-07 20:59:25 +08:00
parent f04729b4bf
commit 985bf0170c
+3
View File
@@ -42,6 +42,9 @@ const route = new Hono<{ Variables: { user: User } }>()
const startTime = Date.now()
while (Date.now() - startTime < timeoutMs) {
if (stream.aborted) {
break
}
// Query new entries from the DB
const newEntries = await prisma.agentSessionEntry.findMany({
where: {