Fix/plugin race condition (#14253)
This commit is contained in:
parent
42b13bd312
commit
490b6d092e
11 changed files with 116 additions and 41 deletions
|
|
@ -2,6 +2,7 @@ import logging
|
|||
import time
|
||||
|
||||
from configs import dify_config
|
||||
from contexts.wrapper import RecyclableContextVar
|
||||
from dify_app import DifyApp
|
||||
|
||||
|
||||
|
|
@ -16,6 +17,12 @@ def create_flask_app_with_configs() -> DifyApp:
|
|||
dify_app = DifyApp(__name__)
|
||||
dify_app.config.from_mapping(dify_config.model_dump())
|
||||
|
||||
# add before request hook
|
||||
@dify_app.before_request
|
||||
def before_request():
|
||||
# add an unique identifier to each request
|
||||
RecyclableContextVar.increment_thread_recycles()
|
||||
|
||||
return dify_app
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue