mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 15:09:46 +08:00
feat: propagate request correlation context
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from contextvars import copy_context
|
||||
|
||||
from app.runtime.config import settings
|
||||
from app.foundation.singleton import Singleton
|
||||
@@ -20,7 +21,8 @@ class ThreadHelper(metaclass=Singleton):
|
||||
:param kwargs: 参数
|
||||
:return: future
|
||||
"""
|
||||
return self.pool.submit(func, *args, **kwargs)
|
||||
context = copy_context()
|
||||
return self.pool.submit(context.run, func, *args, **kwargs)
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user