File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,12 +6,8 @@ class CoreObject(object):
66
77 def __init__ (self , * args , ** kwargs ):
88 self .locator = Locator ()
9- self . transaction_id = None
9+ get_transaction ()
1010
1111 @property
1212 def transaction (self ) -> Transaction :
13- transaction = get_transaction ()
14- if transaction :
15- self .transaction_id = transaction .id
16-
17- return transaction
13+ return get_transaction ()
Original file line number Diff line number Diff line change @@ -134,5 +134,7 @@ def delete_transaction() -> None:
134134 if transaction := get_transaction (is_create = False ):
135135 if hasattr (LOCAL_STORAGE , transaction .id ):
136136 delattr (LOCAL_STORAGE , transaction .id )
137- elif hasattr (LOCAL_STORAGE , transaction .thread_id ):
138- delattr (LOCAL_STORAGE , transaction .thread_id )
137+
138+ thread_id = str (threading .current_thread ().ident )
139+ if hasattr (LOCAL_STORAGE , thread_id ):
140+ delattr (LOCAL_STORAGE , thread_id )
You can’t perform that action at this time.
0 commit comments