Set proccess_instance_id when creating a new thread (#1831)

This commit is contained in:
jbirddog 2024-06-27 10:43:46 -04:00 committed by GitHub
parent bcb124813d
commit e68c626418
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -118,11 +118,13 @@ class ExecutionStrategy:
app: flask.app.Flask,
user: Any | None,
process_model_identifier: str,
process_instance_id: int,
) -> SpiffTask:
with app.app_context():
tld = current_app.config.get("THREAD_LOCAL_DATA")
if tld:
tld.process_model_identifier = process_model_identifier
tld.process_instance_id = process_instance_id
g.user = user
@ -211,6 +213,7 @@ class ExecutionStrategy:
current_app._get_current_object(),
user,
process_instance.process_model_identifier,
process_instance.id,
)
)
for future in concurrent.futures.as_completed(futures):
@ -229,6 +232,7 @@ class ExecutionStrategy:
current_app._get_current_object(),
user,
process_instance.process_model_identifier,
process_instance.id,
)
self.delegate.did_complete_task(spiff_task)