mirror of
https://github.com/open-webui/open-webui
synced 2025-06-09 16:07:54 +00:00
Update imports to match anyio docs
This commit is contained in:
parent
e19554e9a8
commit
f77f6cd1e2
@ -11,13 +11,13 @@ import random
|
|||||||
|
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from urllib.parse import urlencode, parse_qs, urlparse
|
from urllib.parse import urlencode, parse_qs, urlparse
|
||||||
from anyio import to_thread
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from aiocache import cached
|
from aiocache import cached
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
import anyio.to_thread
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
@ -439,7 +439,8 @@ async def lifespan(app: FastAPI):
|
|||||||
|
|
||||||
pool_size = THREAD_POOL_SIZE
|
pool_size = THREAD_POOL_SIZE
|
||||||
if pool_size and pool_size > 0:
|
if pool_size and pool_size > 0:
|
||||||
to_thread.current_default_thread_limiter().total_tokens = pool_size
|
limiter = anyio.to_thread.current_default_thread_limiter()
|
||||||
|
limiter.total_tokens = pool_size
|
||||||
|
|
||||||
asyncio.create_task(periodic_usage_pool_cleanup())
|
asyncio.create_task(periodic_usage_pool_cleanup())
|
||||||
yield
|
yield
|
||||||
|
Loading…
Reference in New Issue
Block a user