mirror of
https://github.com/open-webui/open-webui
synced 2025-06-12 17:33:11 +00:00
refac
This commit is contained in:
parent
68f5ff540c
commit
08b6ea0e17
@ -1262,7 +1262,16 @@ ENABLE_USER_WEBHOOKS = PersistentConfig(
|
||||
)
|
||||
|
||||
# FastAPI / AnyIO settings
|
||||
THREAD_POOL_SIZE = int(os.getenv("THREAD_POOL_SIZE", "0"))
|
||||
THREAD_POOL_SIZE = os.getenv("THREAD_POOL_SIZE", None)
|
||||
|
||||
if THREAD_POOL_SIZE is not None and isinstance(THREAD_POOL_SIZE, str):
|
||||
try:
|
||||
THREAD_POOL_SIZE = int(THREAD_POOL_SIZE)
|
||||
except ValueError:
|
||||
log.warning(
|
||||
f"THREAD_POOL_SIZE is not a valid integer: {THREAD_POOL_SIZE}. Defaulting to None."
|
||||
)
|
||||
THREAD_POOL_SIZE = None
|
||||
|
||||
|
||||
def validate_cors_origins(origins):
|
||||
|
@ -461,10 +461,9 @@ async def lifespan(app: FastAPI):
|
||||
log.info("Installing external dependencies of functions and tools...")
|
||||
install_tool_and_function_dependencies()
|
||||
|
||||
pool_size = THREAD_POOL_SIZE
|
||||
if pool_size and pool_size > 0:
|
||||
if THREAD_POOL_SIZE and THREAD_POOL_SIZE > 0:
|
||||
limiter = anyio.to_thread.current_default_thread_limiter()
|
||||
limiter.total_tokens = pool_size
|
||||
limiter.total_tokens = THREAD_POOL_SIZE
|
||||
|
||||
asyncio.create_task(periodic_usage_pool_cleanup())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user