samples-python
samples-python copied to clipboard
Use `asyncio.to_thread` to avoid `DeadlockError` while sending exception to Sentry
What was changed
Make the capture_exception call async in Sentry intercepor
Why?
Use asyncio.to_thread to avoid DeadlockError while sending exception to Sentry
Checklist
-
Refs #140
-
How was this tested: In production _DeadlockError was raised
-
Any docs updates needed? No
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Well, well
File "/app/project/temporal/interceptor.py", line 129, in execute_workflow
await asyncio.to_thread(scope.capture_exception, e)
File "/usr/local/lib/python3.14/asyncio/threads.py", line 25, in to_thread
return await loop.run_in_executor(None, func_call)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/asyncio/events.py", line 337, in run_in_executor
raise NotImplementedError