Increase Presidio startup timeout for multi-language images (#62)
authorStefan Gasser <redacted>
Mon, 26 Jan 2026 08:26:19 +0000 (09:26 +0100)
committerGitHub <redacted>
Mon, 26 Jan 2026 08:26:19 +0000 (09:26 +0100)
The EU image loads 9 spaCy language models which takes ~2 minutes.
The previous 30-second timeout caused PasteGuard to restart multiple
times before Presidio was ready.

- Increase default timeout from 30s to 180s
- Add PRESIDIO_STARTUP_TIMEOUT env var for customization
- Document startup time in config and docs

Fixes #58

docs/configuration/pii-detection.mdx
src/index.ts

index c8a7417e0f9854177fff6a46502fd1035f0f6aaf..cb210580ac1064296c4d64fc08fd4f8e9ba9dc3a 100644 (file)
@@ -38,6 +38,8 @@ Languages are auto-configured per Docker image:
 - **`:en` image** → English only
 - **`:eu` image** → English, German, Spanish, French, Italian, Dutch, Polish, Portuguese, Romanian
 
+Each language adds ~10s to startup time as spaCy models are loaded.
+
 For custom language builds:
 
 ```bash
index 33966d9b5e2b744f850c798e85891d1265d4cc28..2530a63628ed37a3300af898bf0b450104335ec1 100644 (file)
@@ -117,9 +117,10 @@ async function validateStartup() {
 
   const detector = getPIIDetector();
 
-  // Wait for Presidio to be ready
+  // Wait for Presidio to be ready (multi-language setups need longer to load spaCy models)
+  const startupTimeout = Number(process.env.PASTEGUARD_STARTUP_TIMEOUT) || 180;
   console.log("[STARTUP] Connecting to Presidio...");
-  const ready = await detector.waitForReady(30, 1000);
+  const ready = await detector.waitForReady(startupTimeout, 1000);
 
   if (!ready) {
     console.error(
git clone https://git.99rst.org/PROJECT