Repository navigation
perf(bot): cut yt-dlp timeout from 15s to 6s - #2044
Conversation
Every stream resolution attempt that hits this timeout blocks the whole fallback chain for its full duration before SoundCloud even gets tried, directly taxing perceived playback latency whenever yt-dlp is degraded (rate-limited or blocked upstream).
|
Warning Review limit reached
Next review available in: 10 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Shortens the yt-dlp stream-start timeout in streamViaYtDlp from 15s to 6s to cut fallback latency when yt-dlp is degraded, and updates the lifecycle spec's timer advance to match.
No blocking issues surfaced. 3 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 45 functions depend on the 35 functions this change touches.
Health — this change adds coupling hotspots:
- new:
sendNowPlayingEmbed()— 3 callers, 12 callees - new:
createResilientStream()— 2 callers, 12 callees - new:
setupTrackHandlers()— 4 callers, 6 callees - new:
handlePlayerStart()— 2 callers, 10 callees
Verification — 45 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 38 function(s) in the blast radius were not formally verified this run
· 4 more finding(s) on lines outside this diff (see the check run).
There was a problem hiding this comment.
No issues found across 2 files
Requires human review: Cuts the yt-dlp stream-start timeout from 15s to 6s, an operational tuning change that needs human sign-off on the latency/fallback tradeoff.
Re-trigger cubic
|
🤖 I have created a release *beep* *boop* --- <details><summary>2.39.6</summary> ## [2.39.6](v2.39.5...v2.39.6) (2026-08-22) ### Bug Fixes * **bot:** drop the audio-features scoring path, spotify returns 403 ([#2074](#2074)) ([11891bf](11891bf)) * **bot:** drop the autoplay arm that calls a removed spotify endpoint ([#2071](#2071)) ([682a795](682a795)) * **bot:** fall back past a dead spotify arm in /artist ([#2052](#2052)) ([45dc998](45dc998)) * **bot:** make three silent /play failures observable ([#2062](#2062)) ([e6b2810](e6b2810)) * **bot:** pick closest-duration soundcloud fallback match ([#2049](#2049)) ([738efb8](738efb8)) * **bot:** report a dead autoplay replenish at error level ([#2063](#2063)) ([2c5962e](2c5962e)) * **bot:** report spotify extractor health instead of failing silently ([#2060](#2060)) ([ddaa287](ddaa287)) * **bot:** rerank search results toward exact artist/title match ([#2045](#2045)) ([0c719d5](0c719d5)) * **bot:** resolve /album text queries to an album url ([#2053](#2053)) ([4498299](4498299)) * **bot:** restore youtube-dl-exec, discord-player-youtubei needs it undeclared ([#2040](#2040)) ([c75475b](c75475b)) * **bot:** stop reporting an outage when the fallbacks found nothing ([#2069](#2069)) ([37412e2](37412e2)) * **bot:** surface dead last.fm env session key to sentry ([#2047](#2047)) ([3c97291](3c97291)) * **bot:** update a case reason through the service layer ([#2066](#2066)) ([187d783](187d783)) * **bot:** use metadata setter instead of direct property assignment ([#2042](#2042)) ([740d53e](740d53e)) ### Performance Improvements * **bot:** cut yt-dlp timeout from 15s to 6s ([#2044](#2044)) ([39e9e3c](39e9e3c)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).



Summary
Every stream resolution attempt that hits the yt-dlp timeout blocks the whole fallback chain for its full duration before SoundCloud even gets tried — directly taxing perceived
/playlatency whenever yt-dlp is degraded (currently rate-limited/blocked by YouTube, see the youtube-cookies issue being tracked separately). 15s per attempt was excessive; 6s still gives a real slow-but-working response room while capping the worst-case tax users feel per song.Test plan
npx jest streamBridge.spec.ts— 36/36 passing (updated the fake-timers timeout test to match)Summary by cubic
Cuts the yt-dlp stream-start timeout from 15s to 6s to reduce worst-case /play latency when yt-dlp is slow or rate-limited. Previously fallback to SoundCloud waited 15s; now it fails after 6s and proceeds to fallback sooner.
packages/bot/src/handlers/player/streamBridge.ts; updated fake-timers expectation inpackages/bot/src/handlers/player/streamBridge.spec.ts.Written for commit 940e5dd. Summary will update on new commits.