Skip to content

Commit ebf0327

Browse files
Merge pull request #37 from groupthinking/copilot/sub-pr-33-yet-again
Fix AbortController timer leaks in fetch timeout paths
2 parents f925e30 + 0b66974 commit ebf0327

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

apps/web/src/app/api/transcribe/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ export async function POST(request: Request) {
4747
headers: { 'Content-Type': 'application/json' },
4848
body: JSON.stringify({ video_url: url, language }),
4949
signal: controller.signal,
50-
});
51-
clearTimeout(timeout);
50+
}).finally(() => clearTimeout(timeout));
5251

5352
if (ytResponse.ok) {
5453
const result = await ytResponse.json();

apps/web/src/app/api/video/route.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ export async function POST(request: Request) {
3838
headers: { 'Content-Type': 'application/json' },
3939
body: JSON.stringify({ video_url: url, language: 'en' }),
4040
signal: controller.signal,
41-
});
42-
clearTimeout(timeout);
41+
}).finally(() => clearTimeout(timeout));
4342

4443
if (response.ok) {
4544
const result = await response.json();

0 commit comments

Comments
 (0)