Skip to content

Commit

Permalink
add dangerous override
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Oct 7, 2024
1 parent fde5383 commit 79751f7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/danswer/configs/app_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@

VESPA_REQUEST_TIMEOUT = int(os.environ.get("VESPA_REQUEST_TIMEOUT") or "0") or None

SYSTEM_RECURSION_LIMIT = int(os.environ.get("SYSTEM_RECURSION_LIMIT") or "1000")

#####
# Enterprise Edition Configs
Expand Down
1 change: 1 addition & 0 deletions backend/danswer/indexing/chunker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
MAX_METADATA_PERCENTAGE = 0.25
CHUNK_MIN_CONTENT = 256


logger = setup_logger()


Expand Down
8 changes: 8 additions & 0 deletions backend/danswer/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys
import time
import traceback
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
Expand Down Expand Up @@ -30,6 +32,7 @@
from danswer.configs.app_configs import LOG_ENDPOINT_LATENCY
from danswer.configs.app_configs import OAUTH_CLIENT_ID
from danswer.configs.app_configs import OAUTH_CLIENT_SECRET
from danswer.configs.app_configs import SYSTEM_RECURSION_LIMIT
from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_OVERFLOW
from danswer.configs.app_configs import POSTGRES_API_SERVER_POOL_SIZE
from danswer.configs.app_configs import USER_AUTH_SECRET
Expand Down Expand Up @@ -140,6 +143,11 @@ def include_router_with_global_prefix_prepended(

@asynccontextmanager
async def lifespan(app: FastAPI) -> AsyncGenerator:
# Set recursion limit
if SYSTEM_RECURSION_LIMIT is not None:
sys.setrecursionlimit(SYSTEM_RECURSION_LIMIT)
logger.notice(f"System recursion limit set to {SYSTEM_RECURSION_LIMIT}")

SqlEngine.set_app_name(POSTGRES_WEB_APP_NAME)
SqlEngine.init_engine(
pool_size=POSTGRES_API_SERVER_POOL_SIZE,
Expand Down
2 changes: 2 additions & 0 deletions deployment/docker_compose/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ services:
- MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server}
- MODEL_SERVER_PORT=${MODEL_SERVER_PORT:-}
- VESPA_REQUEST_TIMEOUT=${VESPA_REQUEST_TIMEOUT:-}
# We do not recommend changing this value
- SYSTEM_RECURSION_LIMIT=${SYSTEM_RECURSION_LIMIT:-}
# Leave this on pretty please? Nothing sensitive is collected!
# https://docs.danswer.dev/more/telemetry
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
Expand Down
2 changes: 2 additions & 0 deletions deployment/docker_compose/docker-compose.gpu-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ services:
- MODEL_SERVER_HOST=${MODEL_SERVER_HOST:-inference_model_server}
- MODEL_SERVER_PORT=${MODEL_SERVER_PORT:-}
- VESPA_REQUEST_TIMEOUT=${VESPA_REQUEST_TIMEOUT:-}
# We do not recommend changing this value
- SYSTEM_RECURSION_LIMIT=${SYSTEM_RECURSION_LIMIT:-}
# Leave this on pretty please? Nothing sensitive is collected!
# https://docs.danswer.dev/more/telemetry
- DISABLE_TELEMETRY=${DISABLE_TELEMETRY:-}
Expand Down

0 comments on commit 79751f7

Please sign in to comment.