fix(providers): Treat a 429 as busy, not as a plain panel or a dead provider #37

Merged
namillis merged 1 commit from fix/pool-429 into main 2026-11-09 18:00:01 +00:00
Owner

What was wrong

The pool allows 60 player_api.php calls a minute per login and answers the rest with HTTP 429 and Retry-After: 60. The app read that 429 two wrong ways:

  • pool_info: a 429 was cached as the answer "plain panel" for the rest of the app run. Retry, stop, sources, live game info and the shorter guide (guide_window) stayed off until the app was restarted.
  • Reachability: a 429 counted as "provider down". With a backup provider set, a rate-limited launch moved Home to the backup.

What changed

  • XtreamClient.kt: PoolCheck gets retryAfterMs, set from a 429's Retry-After (seconds or an HTTP date; 1 minute when it names none). A 429 on reachable() that asks to wait 2 minutes or less counts as reachable. A longer wait, like the pool's 15-minute lockout after repeated bad passwords, still counts as down.
  • ProviderRepository.kt: a 429 on pool_info counts as plain only for that wait, kept between 1 and 15 minutes, and then pool_info is asked again, the same way a timeout already worked. A real answer is still kept for the app run.

Verified

  • testDebugUnitTest (629 tests), lintDebug and assembleDebug pass. PoolFeaturesCacheTest.kt adds the 429 cases: Retry-After in seconds, missing, too short, too long, as a date, and a 503 still not being cached. XtreamReachableTest.kt covers an accepted login, a refused login, a 503, short 429s and the 15-minute lockout.
  • LiveWireTV_API34 emulator with the tv3 login, against the real pool. Before each launch I used up tv3's minute from the Mac (61 pool_info calls, then 429), so the app launched straight into 429s. Temporary logging, removed before commit.
    main This branch
    pool_info at launch 429, cached as "plain" for the app run; never asked again 429, plain for 60 s; asked again at +60 s and got all five features
    With a backup provider set reachability check false; Home moved to the backup (iptv-org's "00s Replay") reachability check true; Home stayed on the pool (Fox News)

Not changed

  • While pool_info counts as plain, a channel list downloaded then has its Live Now games stripped, and that list stays fresh in the channel cache for 10 minutes. That's how a pool_info timeout already worked.
  • Other calls that get a 429 still fail just for that request, as before (an empty list, or the player's "refused" retry).
## What was wrong The pool allows 60 `player_api.php` calls a minute per login and answers the rest with HTTP 429 and `Retry-After: 60`. The app read that 429 two wrong ways: - **`pool_info`:** a 429 was cached as the answer "plain panel" for the rest of the app run. Retry, stop, sources, live game info and the shorter guide (`guide_window`) stayed off until the app was restarted. - **Reachability:** a 429 counted as "provider down". With a backup provider set, a rate-limited launch moved Home to the backup. ## What changed - `XtreamClient.kt`: `PoolCheck` gets `retryAfterMs`, set from a 429's `Retry-After` (seconds or an HTTP date; 1 minute when it names none). A 429 on `reachable()` that asks to wait 2 minutes or less counts as reachable. A longer wait, like the pool's 15-minute lockout after repeated bad passwords, still counts as down. - `ProviderRepository.kt`: a 429 on `pool_info` counts as plain only for that wait, kept between 1 and 15 minutes, and then `pool_info` is asked again, the same way a timeout already worked. A real answer is still kept for the app run. ## Verified - `testDebugUnitTest` (629 tests), `lintDebug` and `assembleDebug` pass. `PoolFeaturesCacheTest.kt` adds the 429 cases: `Retry-After` in seconds, missing, too short, too long, as a date, and a 503 still not being cached. `XtreamReachableTest.kt` covers an accepted login, a refused login, a 503, short 429s and the 15-minute lockout. - LiveWireTV_API34 emulator with the tv3 login, against the real pool. Before each launch I used up tv3's minute from the Mac (61 `pool_info` calls, then 429), so the app launched straight into 429s. Temporary logging, removed before commit. | | `main` | This branch | |---|---|---| | `pool_info` at launch | 429, cached as "plain" for the app run; never asked again | 429, plain for 60 s; asked again at +60 s and got all five features | | With a backup provider set | reachability check false; Home moved to the backup (iptv-org's "00s Replay") | reachability check true; Home stayed on the pool (Fox News) | ## Not changed - While `pool_info` counts as plain, a channel list downloaded then has its Live Now games stripped, and that list stays fresh in the channel cache for 10 minutes. That's how a `pool_info` timeout already worked. - Other calls that get a 429 still fail just for that request, as before (an empty list, or the player's "refused" retry).
fix(providers): Treat a 429 as busy, not as a plain panel or a dead provider
All checks were successful
CI / test (pull_request) Successful in 6m57s
36e67e169f
The pool allows 60 player_api calls a minute per login and answers the
rest with 429 and Retry-After: 60. The app read that two wrong ways.

pool_info: a 429 was cached as the answer "plain panel" for the rest
of the app run, so retry, stop, sources, live game info and
guide_window stayed off until the app restarted. It now counts as
plain only for as long as Retry-After asks (kept between 1 and 15
minutes; 1 minute when it names none), then pool_info is asked again.

Reachability: a 429 counted as "provider down", so with a backup set
the app moved Home to the backup. A 429 asking to wait 2 minutes or
less now counts as up. A longer wait, like the pool's 15-minute lockout
after repeated bad passwords, still counts as down.
namillis deleted branch fix/pool-429 2026-11-09 18:00:01 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
namillis/LiveWireTV!37
No description provided.