Skip to content

Plex Connect: fix queue cap of 50#3187

Draft
anatosun wants to merge 1 commit intomusic-assistant:devfrom
anatosun:fix/plex-connect-queue-cap
Draft

Plex Connect: fix queue cap of 50#3187
anatosun wants to merge 1 commit intomusic-assistant:devfrom
anatosun:fix/plex-connect-queue-cap

Conversation

@anatosun
Copy link
Copy Markdown
Contributor

For now a very permissive cap has been set. I think it should fix most issues. A more evolved fix should use the pagination and build the queue while parcouring the pages. Let me defer that to a later PR.

Copilot AI review requested due to automatic review settings February 18, 2026 16:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Plex play queue truncation by requesting a larger item window when fetching an existing Plex PlayQueue, avoiding the default ~50 item cap that breaks longer queues.

Changes:

  • Increase PlayQueue.get(...) fetch window to 500 when loading a queue for playback.
  • Increase PlayQueue.get(...) fetch window to 500 when refreshing/syncing an updated queue.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Use plexapi to fetch the play queue
def fetch_queue() -> PlayQueue:
return PlayQueue.get(self.provider._plex_server, playQueueID=queue_id)
return PlayQueue.get(self.provider._plex_server, playQueueID=queue_id, window=500)
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

Increasing the PlayQueue fetch window to 500 can significantly increase downstream work: _load_remaining_queue_tracks uses asyncio.gather over all remaining items, so this change can trigger hundreds of concurrent get_track calls. Consider adding a concurrency limit (e.g., semaphore/chunking) or otherwise throttling track resolution to avoid overloading Plex/MA and to reduce memory/latency spikes on large queues.

Suggested change
return PlayQueue.get(self.provider._plex_server, playQueueID=queue_id, window=500)
# Use a conservative window size to avoid excessive downstream concurrency
return PlayQueue.get(self.provider._plex_server, playQueueID=queue_id, window=50)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is a valid concern. Have you tested this with a big play queue to see what it does to latency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right. Let's keep it as a draft until I come up with a better solution but also for people to be aware of the reason of the bug.

Comment thread music_assistant/providers/plex_connect/player_remote.py
Comment thread music_assistant/providers/plex_connect/player_remote.py
@OzGav OzGav added the bugfix label Feb 18, 2026
@OzGav
Copy link
Copy Markdown
Contributor

OzGav commented Feb 18, 2026

Just need to address the copilot comments.

@MarvinSchenkel MarvinSchenkel marked this pull request as draft February 19, 2026 11:28
@OzGav OzGav added this to the 2.9.0 milestone Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants