fix(db): pool à 2 connexions + idle 30 s — cohabitation bleu-vert sur le plan PG à 5 connexionsUnverified
95ede89 parent: 985a720 modified
src/main.rs +5 -1 | @@ -90,8 +90,12 @@ async fn serve() -> Result<()> { | ||
| 90 | 90 | ) |
| 91 | 91 | .init(); |
| 92 | 92 | |
| 93 | + // Le plan PostgreSQL est limité à 5 connexions : 2 max par instance pour | |
| 94 | + // que l'ancienne et la nouvelle cohabitent pendant un déploiement | |
| 95 | + // bleu-vert, et libération rapide des connexions inactives. | |
| 93 | 96 | let pool = PgPoolOptions::new() |
| 94 | - .max_connections(5) | |
| 97 | + .max_connections(2) | |
| 98 | + .idle_timeout(std::time::Duration::from_secs(30)) | |
| 95 | 99 | .connect_with(config::pg_options()?) |
| 96 | 100 | .await |
| 97 | 101 | .context("connexion à la base")?; |
| @@ -90,8 +90,12 @@ async fn serve() -> Result<()> { | |||
| 90 | ) | 90 | ) |
| 91 | .init(); | 91 | .init(); |
| 92 | 92 | ||
| 93 | + // Le plan PostgreSQL est limité à 5 connexions : 2 max par instance pour | ||
| 94 | + // que l'ancienne et la nouvelle cohabitent pendant un déploiement | ||
| 95 | + // bleu-vert, et libération rapide des connexions inactives. | ||
| 93 | let pool = PgPoolOptions::new() | 96 | let pool = PgPoolOptions::new() |
| 94 | - .max_connections(5) | 97 | + .max_connections(2) |
| 98 | + .idle_timeout(std::time::Duration::from_secs(30)) | ||
| 95 | .connect_with(config::pg_options()?) | 99 | .connect_with(config::pg_options()?) |
| 96 | .await | 100 | .await |
| 97 | .context("connexion à la base")?; | 101 | .context("connexion à la base")?; |