Retry the remaining plex.tv calls that had no retry - #209
Merged
Brandon-Haney merged 2 commits intoSep 3, 2026
Conversation
Constructing MyPlexAccount in the `user is None` branch of _fetch_user_watchlist was the last plex.tv entry point without a retry; _get_main_account() and the switchHomeUser path already had one. On an install with no home users that branch is the only watchlist fetch there is, so a single read timeout marked the watchlist incomplete and skipped array restore for the whole run: [USER:Brandon] Fetching watchlist media ERROR (get Plex account for Brandon): plex.tv ... Read timed out WARNING Skipping array restore - watchlist data incomplete Wrapping it in _retry_plextv_call gives the same 3 attempts with 2s/4s backoff as its siblings. Auth failures still fail on the first attempt, and exhausting the retries still guards array restore as before.
myPlexAccount() and users() back the Settings user list and both are plex.tv round trips. A read timeout during the hourly refresh dropped the admin from the list until the next cycle: Refreshing Plex data cache... WARNING Could not get main account: plex.tv ... Read timed out INFO Fetched 24 shared users The shared users loaded from the very next call, so the two blocks keep fetching independently rather than sharing one account. Capped at 2 attempts instead of PLEXTV_MAX_RETRIES: this is reachable from GET /settings/plex/users, so attempts are paid in page latency, and giving up costs a stale user list rather than a skipped array restore.
StudioNirin
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two plex.tv entry points were still unretried while their siblings already had backoff.
The watchlist fetch
Constructing
MyPlexAccountin theuser is Nonebranch of_fetch_user_watchlistwas the last one without a retry._get_main_account()and theswitchHomeUserpath both got one earlier. On an install with no home users that branch is the only watchlist fetch there is, so a single read timeout cost the whole run its array restore:It now goes through
_retry_plextv_callfor the same 3 attempts with 2s/4s backoff as its siblings. Auth failures still fail on the first attempt, and exhausting the retries still guards array restore exactly as before.The Settings user list
myPlexAccount()andusers()both back/settings/plex/usersand both are plex.tv round trips. A read timeout during the hourly refresh dropped the admin from the list until the next cycle, while the shared users loaded fine from the very next call:Capped at 2 attempts rather than
PLEXTV_MAX_RETRIES, because this sits on a page request. Attempts here are paid in page latency, and giving up costs a stale user list rather than a skipped array restore.How to test
Skipping array restore - watchlist data incompleteon the first timeout.Covered by
tests/test_plex_api_main_account_retry.pyandtests/test_settings_service_plextv_retry.py.