Wait for each Plex Wish List add batch to actually finish before sending the next #49
No reviewers
Labels
No labels
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
WulfScience-FOSS/ha-music-own!49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "macsome_8"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Chunking into batches of 25 (previous commit) wasn't enough on its own:
live logs showed a 496-track add reporting success in ~20 seconds, while
Music Assistant's own background-tasks view showed multiple "Add items to
playlist" tasks still queued/running well after our sync had already
finished. Confirmed in MA's own server source
(controllers/music/media/playlists.py): add_playlist_tracks queues a
managed background task and returns immediately without awaiting it -
return self.mass.tasks.run_background_task(...). Firing 20 batches ~1sapart queued a backlog faster than MA could actually process it.
The server does return that BackgroundTask (with an id we can poll via
tasks/get, Scope.SYSTEM_READ) - the music_assistant_client wrapper we were
calling just discards it and returns None. Now calls client.send_command
directly to get the task id back, then polls tasks/get until the task
reaches a real terminal status (success/partial_success/failed/cancelled)
before moving to the next batch, and reports accurate added/failed counts
based on the task's actual outcome instead of assuming success whenever
the initial RPC call didn't raise.
Falls back to the old assume-success behavior if the server response
doesn't include a task id (older MA versions), and if tasks/get itself
fails (e.g. the configured MA token lacks permission), the batch is
counted as failed rather than crashing the sync.