We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb0ad18 commit 7edbbafCopy full SHA for 7edbbaf
sentry_sdk/worker.py
@@ -3,6 +3,7 @@
3
import os
4
import threading
5
import asyncio
6
+import inspect
7
8
from time import sleep, time
9
from sentry_sdk._queue import Queue, FullError
@@ -255,7 +256,12 @@ async def _target(self) -> None:
255
256
while True:
257
callback = await self._queue.get()
258
try:
- callback()
259
+ if inspect.iscoroutinefunction(callback):
260
+ # Callback is an async coroutine, need to await it
261
+ await callback()
262
+ else:
263
+ # Callback is a sync function, need to call it
264
+ callback()
265
except Exception:
266
logger.error("Failed processing job", exc_info=True)
267
finally:
0 commit comments