perf: replace sleep(5) with 429 backoff and add cache warm-up script

This commit is contained in:
2026-07-27 02:06:06 +04:00
parent 3b074f00d8
commit b994383bf4
4 changed files with 100 additions and 21 deletions
+10 -4
View File
@@ -197,7 +197,8 @@ Toutes ces sources sont modifiables dans `includes/config.local.php` (voir <<fr-
│ ├── pleroma-adapter.js # Adaptateur Pleroma → API Mastodon
│ └── pwa-update.js # Enregistrement SW + modal de mise à jour
├── scripts/
── check.sh # Vérifications qualité en local (avant push)
── check.sh # Vérifications qualité en local (avant push)
│ └── warm-cache.php # Préchauffage du cache API (cron)
├── uploads/ # Images d'annonces (non versionné, hors .gitkeep)
├── index.php # Page d'accueil (agrégateur)
├── video.php # Page de lecture d'une vidéo
@@ -415,7 +416,7 @@ Valeurs par défaut issues de `includes/config.default.php`.
| Nombre total d'épisodes affichés
|===
WARNING: Castopod applique un *rate limit* strict (HTTP 429) sur les flux RSS. Le code patiente 5 s entre chaque podcast. *Activez le cache* (`CACHE_ENABLED`) pour éviter ces délais à chaque page.
WARNING: Castopod applique un *rate limit* strict (HTTP 429) sur les flux RSS. Le code applique un backoff exponentiel (5 s, 10 s, 15 s) uniquement en cas de 429. *Activez le cache* (`CACHE_ENABLED`) et préchauffez-le avec `scripts/warm-cache.php` pour éviter ces délais à chaque page.
.Funkwhale (musique, optionnel)
[cols="2,2,3",options="header"]
@@ -695,6 +696,8 @@ TIP: Si vous déployez une instance indépendante, remplacez `LIBERAPAY_URL` par
NOTE: Le cache de l'API PeerTube et de WordPress (`includes/simple-cache.php`) est *toujours actif*, indépendamment de `CACHE_ENABLED`, avec des TTL par endpoint (catégories 1 h, vidéos/recherche 10 min, articles WP 15 min, comptes 5 min). Les fichiers sont stockés dans `cache/api/`.
TIP: Pour éviter que le premier visiteur ne paye le coût des appels API sur cache froid, préchauffez le cache via cron : `php /var/www/annu-kute-ced/scripts/warm-cache.php` (toutes les 5 minutes par exemple).
.Sécurité
[cols="2,2,3",options="header"]
|===
@@ -1167,7 +1170,8 @@ All of these sources can be changed in `includes/config.local.php` (see <<en-con
│ ├── pleroma-adapter.js # Pleroma → Mastodon API adapter
│ └── pwa-update.js # SW registration + update modal
├── scripts/
── check.sh # Local quality checks (before pushing)
── check.sh # Local quality checks (before pushing)
│ └── warm-cache.php # API cache warm-up (cron)
├── uploads/ # Announcement images (not versioned, except .gitkeep)
├── index.php # Homepage (aggregator)
├── video.php # Video playback page
@@ -1385,7 +1389,7 @@ Default values from `includes/config.default.php`.
| Total number of episodes displayed
|===
WARNING: Castopod enforces a strict *rate limit* (HTTP 429) on RSS feeds. The code waits 5 s between podcasts. *Enable the cache* (`CACHE_ENABLED`) to avoid these delays on every page.
WARNING: Castopod enforces a strict *rate limit* (HTTP 429) on RSS feeds. The code applies exponential backoff (5 s, 10 s, 15 s) only on HTTP 429. *Enable the cache* (`CACHE_ENABLED`) and warm it with `scripts/warm-cache.php` to avoid these delays on every page.
.Funkwhale (music, optional)
[cols="2,2,3",options="header"]
@@ -1665,6 +1669,8 @@ TIP: If you deploy an independent instance, replace `LIBERAPAY_URL` with your ow
NOTE: The PeerTube API and WordPress cache (`includes/simple-cache.php`) is *always on*, regardless of `CACHE_ENABLED`, with per-endpoint TTLs (categories 1 h, videos/search 10 min, WP posts 15 min, accounts 5 min). Files are stored in `cache/api/`.
TIP: To prevent the first visitor from paying the cost of API calls on a cold cache, warm the cache via cron: `php /var/www/annu-kute-ced/scripts/warm-cache.php` (every 5 minutes for example).
.Security
[cols="2,2,3",options="header"]
|===