Skip to content

Commit cf2aef2

Browse files
committed
fix(transaction): make ContextVarsTransactionContextPropagator use per-instance storage
Signed-off-by: marcozabel <marco.zabel@dynatrace.com>
1 parent 2be0619 commit cf2aef2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

openfeature/transaction_context/context_var_transaction_context_propagator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77

88

99
class ContextVarsTransactionContextPropagator(TransactionContextPropagator):
10-
_transaction_context_var: ContextVar[EvaluationContext | None] = ContextVar(
11-
"transaction_context", default=None
12-
)
10+
def __init__(self) -> None:
11+
self._transaction_context_var: ContextVar[EvaluationContext | None] = (
12+
ContextVar(f"transaction_context_{id(self)}", default=None)
13+
)
1314

1415
def get_transaction_context(self) -> EvaluationContext:
1516
context = self._transaction_context_var.get()

0 commit comments

Comments
 (0)