Fix AbortController timer leaks in fetch timeout paths#37
Merged
groupthinking merged 2 commits intoclaude/slack-check-status-update-R47Phfrom Feb 27, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the EventRelay-pr-37 environment in EventRelay
|
…h abort/error Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add frontend-only video analysis pipeline
Fix AbortController timer leaks in fetch timeout paths
Feb 27, 2026
ebf0327
into
claude/slack-check-status-update-R47Ph
8 of 12 checks passed
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes timer leak bugs where clearTimeout was placed after await fetch(...), meaning timers were never cleared when a fetch threw (e.g., due to network errors or AbortController abort). By replacing the post-await clearTimeout call with .finally(() => clearTimeout(timeout)), the timer is guaranteed to be cleared in all execution paths.
Changes:
- Moved
clearTimeoutinto.finally()on the backend fetch call in/api/video/route.tsto guarantee the 15s timer always clears. - Same fix applied in
/api/transcribe/route.tsfor the 8s backend fetch timer.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
apps/web/src/app/api/video/route.ts |
Chains .finally(() => clearTimeout(timeout)) on the backend fetch so the 15s AbortController timer is always cleared |
apps/web/src/app/api/transcribe/route.ts |
Same fix for the 8s AbortController timer guarding the YouTube backend fetch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clearTimeoutwas called afterawait fetch(...)in both/api/videoand/api/transcribe, meaning timers were never cleared when the request aborted or threw a network error.Changes
/api/video/route.ts— chain.finally(() => clearTimeout(timeout))on the backend fetch so the 15s timer is always cleared/api/transcribe/route.ts— same fix for the 8s YouTube backend fetch timeoutBefore / After
Also confirmed in previous commits:
transcript_segmentscorrectly handles bothtranscript[]andtranscript.segments[]shapesENABLE_VERTEX_AIis parsed as a strict boolean ("1" | "true" | "yes") so values like"0"no longer trigger the slow Vertex AI metadata probe💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.