Fix token renewal: exclude pipeline_status polling endpoint

- Add /documents/pipeline_status to TOKEN_RENEWAL_SKIP_PATHS
- Prevents continuous token renewal from 2-second polling
- Allows authenticated users to be logged out after inactivity
- Update env.example documentation with all polling intervals
This commit is contained in:
yangdx
2025-12-26 12:02:51 +08:00
parent 01aaded80c
commit 54f08cd768
2 changed files with 5 additions and 2 deletions

View File

@@ -62,7 +62,8 @@ OLLAMA_EMULATING_MODEL_TAG=latest
# TOKEN_RENEW_THRESHOLD=0.5
### Note: Token renewal is automatically skipped for certain endpoints:
### - /health: Health check endpoint (no authentication required)
### - /documents/paginated: Frequently polled by client (renewal not needed)
### - /documents/paginated: Frequently polled by client (5-30s interval)
### - /documents/pipeline_status: Very frequently polled by client (2s interval)
### - Rate limit: Minimum 60 seconds between renewals for same user
### API-Key to access LightRAG Server API

View File

@@ -31,10 +31,12 @@ _RENEWAL_MIN_INTERVAL = 60 # Minimum 60 seconds between renewals for same user
# ========== Token Renewal Path Exclusions ==========
# Paths that should NOT trigger token auto-renewal
# - /health: Health check endpoint, no login required
# - /documents/paginated: Client polls this frequently, renewal not needed
# - /documents/paginated: Client polls this frequently (5-30s), renewal not needed
# - /documents/pipeline_status: Client polls this very frequently (2s), renewal not needed
_TOKEN_RENEWAL_SKIP_PATHS = [
"/health",
"/documents/paginated",
"/documents/pipeline_status",
]