Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 10, 2026

Segment pre-caching was only keeping 1-2 segments cached at a time instead of progressively filling the cache with all remaining playlist segments.

Root Cause

cache_next_segment() only cached one segment per invocation. Since it's only called when a cached segment is consumed or a new playlist arrives, the cache filled extremely slowly—leaving most segments uncached.

Changes

  • Batch caching: cache_next_segment() now caches 2 segments per call instead of 1
  • Named constant: Added SEGMENT_CACHE_BATCH_SIZE for maintainability
  • Progress logging: Added tracking of queue depth and cache progress

Behavior

With 8 uncached segments and segment_drop=6:

Playlist extracted → cache 2, queue: 6
Segment 1 consumed → cache 2, queue: 4  
Segment 2 consumed → cache 2, queue: 2
Segment 3 consumed → cache 2, queue: 0

Cache progressively fills without blocking client requests.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 10, 2026 21:13
Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Co-authored-by: paul-1 <6473457+paul-1@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 10, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Optimize playlist handling for better caching Fix segment pre-caching to progressively cache all playlist segments Jan 10, 2026
Copilot AI requested a review from paul-1 January 10, 2026 21:17
@paul-1 paul-1 marked this pull request as ready for review January 10, 2026 21:42
@paul-1 paul-1 merged commit 4afe7aa into Optimize_playlist_handling Jan 10, 2026
@paul-1 paul-1 deleted the copilot/sub-pr-56 branch January 10, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants