Release db.session connection before workflow new thread long time operation (#21726)

Co-authored-by: 李强04 <liqiang04@gaotu.cn>
This commit is contained in:
Qiang Lee 2025-07-01 12:05:29 +08:00 committed by GitHub
parent 1b99e44e99
commit cf2173644e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -219,6 +219,9 @@ class WorkflowAppGenerator(BaseAppGenerator):
# new thread with request context and contextvars
context = contextvars.copy_context()
# release database connection, because the following new thread operations may take a long time
db.session.close()
worker_thread = threading.Thread(
target=self._generate_worker,
kwargs={