mirror of
https://github.com/simonw/datasette.git
synced 2026-10-08 02:17:01 +02:00
Fix for trace_child_tasks exception handling
I had Claude Fable 5 review our use of contextvar and it spotted this place where exceptions were not correctly handled.
This commit is contained in:
parent
fa86ac7b11
commit
d4cb8b464b
2 changed files with 17 additions and 2 deletions
|
|
@ -27,8 +27,10 @@ def get_task_id():
|
|||
@contextmanager
|
||||
def trace_child_tasks():
|
||||
token = trace_task_id.set(get_task_id())
|
||||
yield
|
||||
trace_task_id.reset(token)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
trace_task_id.reset(token)
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue