Add PostgreSQL connection retry configuration options
- Add retry environment variables - Fix asyncpg import in retry tests
This commit is contained in:
parent
e758204ab2
commit
bd535e3e7a
2 changed files with 12 additions and 1 deletions
10
env.example
10
env.example
|
|
@ -303,6 +303,16 @@ POSTGRES_HNSW_M=16
|
||||||
POSTGRES_HNSW_EF=200
|
POSTGRES_HNSW_EF=200
|
||||||
POSTGRES_IVFFLAT_LISTS=100
|
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)
|
### PostgreSQL SSL Configuration (Optional)
|
||||||
# POSTGRES_SSL_MODE=require
|
# POSTGRES_SSL_MODE=require
|
||||||
# POSTGRES_SSL_CERT=/path/to/client-cert.pem
|
# POSTGRES_SSL_CERT=/path/to/client-cert.pem
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@ import os
|
||||||
import time
|
import time
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
import asyncpg
|
|
||||||
from lightrag.kg.postgres_impl import PostgreSQLDB
|
from lightrag.kg.postgres_impl import PostgreSQLDB
|
||||||
|
|
||||||
|
asyncpg = pytest.importorskip("asyncpg")
|
||||||
|
|
||||||
# Load environment variables
|
# Load environment variables
|
||||||
load_dotenv(dotenv_path=".env", override=False)
|
load_dotenv(dotenv_path=".env", override=False)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue