mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 14:04:50 +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()
|
const startTime = Date.now()
|
||||||
|
|
||||||
while (Date.now() - startTime < timeoutMs) {
|
while (Date.now() - startTime < timeoutMs) {
|
||||||
|
if (stream.aborted) {
|
||||||
|
break
|
||||||
|
}
|
||||||
// Query new entries from the DB
|
// Query new entries from the DB
|
||||||
const newEntries = await prisma.agentSessionEntry.findMany({
|
const newEntries = await prisma.agentSessionEntry.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
Reference in New Issue
Block a user