diff --git a/env.example b/env.example index f59c2969..d86b98f7 100644 --- a/env.example +++ b/env.example @@ -303,6 +303,16 @@ POSTGRES_HNSW_M=16 POSTGRES_HNSW_EF=200 POSTGRES_IVFFLAT_LISTS=100 +### PostgreSQL Connection Retry Configuration (Network Robustness) +### Number of retry attempts (1-10, default: 3) +### Initial retry backoff in seconds (0.1-5.0, default: 0.5) +### Maximum retry backoff in seconds (backoff-60.0, default: 5.0) +### Connection pool close timeout in seconds (1.0-30.0, default: 5.0) +# POSTGRES_CONNECTION_RETRIES=3 +# POSTGRES_CONNECTION_RETRY_BACKOFF=0.5 +# POSTGRES_CONNECTION_RETRY_BACKOFF_MAX=5.0 +# POSTGRES_POOL_CLOSE_TIMEOUT=5.0 + ### PostgreSQL SSL Configuration (Optional) # POSTGRES_SSL_MODE=require # POSTGRES_SSL_CERT=/path/to/client-cert.pem diff --git a/tests/test_postgres_retry_integration.py b/tests/test_postgres_retry_integration.py index 71e5c47d..137ba686 100644 --- a/tests/test_postgres_retry_integration.py +++ b/tests/test_postgres_retry_integration.py @@ -16,9 +16,10 @@ import os import time from dotenv import load_dotenv from unittest.mock import patch -import asyncpg from lightrag.kg.postgres_impl import PostgreSQLDB +asyncpg = pytest.importorskip("asyncpg") + # Load environment variables load_dotenv(dotenv_path=".env", override=False)