mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 23:17:37 +00:00
fix(api): prevent SSE connection resource leak by checking stream.aborted
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user