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 1804271 commit 11da869Copy full SHA for 11da869
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
@@ -271,7 +272,12 @@ async def _target(self) -> None:
271
272
while True:
273
callback = await self._queue.get()
274
try:
- callback()
275
+ if inspect.iscoroutinefunction(callback):
276
+ # Callback is an async coroutine, need to await it
277
+ await callback()
278
+ else:
279
+ # Callback is a sync function, need to call it
280
+ callback()
281
except Exception:
282
logger.error("Failed processing job", exc_info=True)
283
finally:
0 commit comments