refactor: assembling the app features in modular way (#9129)

Signed-off-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
Bowen Liang
2024-11-30 23:05:22 +08:00
committed by GitHub
parent 3bc4dc58d7
commit 9b46b02717
30 changed files with 396 additions and 318 deletions

View File

@@ -0,0 +1,19 @@
from configs import dify_config
def apply_gevent_threading_patch():
"""
Run threading patch by gevent
to make standard library threading compatible.
Patching should be done as early as possible in the lifecycle of the program.
:return:
"""
if not dify_config.DEBUG:
from gevent import monkey
from grpc.experimental import gevent as grpc_gevent
# gevent
monkey.patch_all()
# grpc gevent
grpc_gevent.init_gevent()