-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Hi, was just implementing a context propagation interceptor based on this sample: https://github.com/temporalio/samples-python/blob/main/context_propagation/README.md
After a bit of experimentation, it seems like the the contextvar value is automatically restored to the previous value during multiple concurrent workflow runs and even after an activity finishes executing (if the var was updated inside the activity).
I was wondering if the ContextVar.reset() usage in the sample is redundant? or are there scenarios where it might have an effect?
I'm using a thread pool executor for my worker, so perhaps thats why it seems like ContextVar.reset() does not do anything? temporalio/sdk-python#263
Would it be safe to remove the resetting part when using a thread pool executor for activity tasks? And for workflows in general if I don't want the context vars state to leak between them?