mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-04-25 06:35:18 +00:00
chore: create script for selfhosted reflector (#866)
* self hosted with self gpu * add optional ollama model * garage ports * exposes ports and changes curl * custom domain * try to fix wroker * build locallly * documentation * docs format * precommit
This commit is contained in:
committed by
GitHub
parent
a8ad237d85
commit
cdd974b935
@@ -4,8 +4,9 @@ from uuid import uuid4
|
||||
|
||||
from celery import current_task
|
||||
|
||||
from reflector.db import get_database
|
||||
from reflector.db import _database_context, get_database
|
||||
from reflector.llm import llm_session_id
|
||||
from reflector.ws_manager import reset_ws_manager
|
||||
|
||||
|
||||
def asynctask(f):
|
||||
@@ -20,6 +21,14 @@ def asynctask(f):
|
||||
return await f(*args, **kwargs)
|
||||
finally:
|
||||
await database.disconnect()
|
||||
_database_context.set(None)
|
||||
|
||||
if current_task:
|
||||
# Reset cached connections before each Celery task.
|
||||
# Each asyncio.run() creates a new event loop, making connections
|
||||
# from previous tasks stale ("Future attached to a different loop").
|
||||
_database_context.set(None)
|
||||
reset_ws_manager()
|
||||
|
||||
coro = run_with_db()
|
||||
if current_task:
|
||||
|
||||
Reference in New Issue
Block a user