From 6f35e2cdea83ee862725ef3d95e79beb377f3889 Mon Sep 17 00:00:00 2001 From: Rushil Perera Date: Sun, 22 Sep 2024 16:23:38 -0400 Subject: [PATCH] fix: close SSE stream when error occurred --- src/controllers/auth/anilist/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/auth/anilist/index.ts b/src/controllers/auth/anilist/index.ts index ea11271..70b5018 100644 --- a/src/controllers/auth/anilist/index.ts +++ b/src/controllers/auth/anilist/index.ts @@ -212,7 +212,8 @@ app.openapi(route, async (c) => { async (err, stream) => { console.error("Error occurred in SSE"); console.error(err); - stream.writeln("An error occurred"); + await stream.writeln("An error occurred"); + await stream.close(); }, ); });