From: Stefan Gasser Date: Mon, 26 Jan 2026 08:26:19 +0000 (+0100) Subject: Increase Presidio startup timeout for multi-language images (#62) X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=a88c1049d22ef19f4869503ff8dd78a56e259a47;p=sgasser-llm-shield.git Increase Presidio startup timeout for multi-language images (#62) 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 --- diff --git a/docs/configuration/pii-detection.mdx b/docs/configuration/pii-detection.mdx index c8a7417..cb21058 100644 --- a/docs/configuration/pii-detection.mdx +++ b/docs/configuration/pii-detection.mdx @@ -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 diff --git a/src/index.ts b/src/index.ts index 33966d9..2530a63 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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(