Enhance PIA rate limit handling in gluetun WireGuard rotator. Introduce persistent cooldown management and improve retry logic for token requests. Update README to reflect new RATE_LIMIT_PATH variable and clarify cooldown behavior.
Build and Push Docker Images / build-and-push (push) Successful in 20s

This commit is contained in:
2026-08-14 22:25:12 +02:00
parent 9700944599
commit f1e4a91bd8
3 changed files with 121 additions and 22 deletions
@@ -50,7 +50,8 @@ docker run --rm --entrypoint /opt/venv/bin/python \
| `TOKEN_CACHE_TTL` | `20h` | Hergebruik token i.p.v. opnieuw inloggen |
| `PIA_CA_PATH` | `/config/cache/ca.rsa.4096.crt` | Gecachete PIA CA voor `addKey` TLS |
| `FORCE_TOKEN_REFRESH` | `false` | `true` = token-cache negeren |
| `RATE_LIMIT_WAIT_SECONDS` | `3600` | Wachttijd bij PIA rate-limit vóór retry |
| `RATE_LIMIT_WAIT_SECONDS` | `3600` | Cooldown bij PIA rate-limit (blijft gelden na container-restart) |
| `RATE_LIMIT_PATH` | `/config/cache/pia-rate-limit.json` | Persistente cooldown-timestamp |
| `TZ` | `Europe/Brussels` | Tijdzone voor scheduling |
`ROTATE_CRON` voorbeelden: `0 */6 * * *`, `0 3 * * 1-5`, `@hourly`. Quote in Compose: `'ROTATE_CRON=0 3 * * *'`.
@@ -113,6 +114,6 @@ Behoud minimaal:
2. **Pin** de snelste server-IP (niet alleen regio)
3. Altijd nieuw keypair + `addKey` (reauth), daarna containers herstarten
4. Caches: serverlist, token (~20u), CA-cert — alleen om overbodige API-calls te beperken
5. Bij rate-limit: `RATE_LIMIT_WAIT_SECONDS` (default 1 uur) wachten en opnieuw proberen
5. Bij rate-limit: cooldown van `RATE_LIMIT_WAIT_SECONDS` (default 1 uur), **persistent op disk** zodat restarts geen extra API-calls doen; daarna opnieuw proberen. Andere token-endpoints worden eerst nog geprobeerd.
**Let op:** zet gluetun **niet** in `RESTART_CONTAINERS`; gebruik `GLUETUN_CONTAINER`. Elke echte rotatie geeft korte downtime.