Skip to content

perf(bot): cut yt-dlp timeout from 15s to 6s - #2044

Merged
LucasSantana-Dev merged 1 commit into
mainfrom
perf/reduce-ytdlp-timeout
Aug 20, 2026
Merged

LucasSantana-Dev merged 1 commit into
mainfrom
perf/reduce-ytdlp-timeout

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Aug 20, 2026 •

Copy link
Copy Markdown
Owner

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 /play latency 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.

  • Change is in packages/bot/src/handlers/player/streamBridge.ts; updated fake-timers expectation in packages/bot/src/handlers/player/streamBridge.spec.ts.
  • No config or migration changes; only the wait before SoundCloud fallback is shorter in degraded YouTube conditions.

Written for commit 940e5dd. Summary will update on new commits.

Review in cubic

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).
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@LucasSantana-Dev, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review or push new commits to the PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 01cd6aac-0478-4ae0-aeb0-d697fe07b1fe

📥 Commits

Reviewing files that changed from the base of the PR and between 740d53e and 940e5dd.

📒 Files selected for processing (2)
  • packages/bot/src/handlers/player/streamBridge.spec.ts
  • packages/bot/src/handlers/player/streamBridge.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 39e9e3c into main Aug 20, 2026
50 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the perf/reduce-ytdlp-timeout branch August 20, 2026 18:33
LucasSantana-Dev added a commit that referenced this pull request Aug 22, 2026
🤖 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).
This was referenced Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant