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.
2 parents 55b606a + ef61134 commit ad93516Copy full SHA for ad93516
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
@@ -305,7 +306,11 @@ async def _target(self) -> None:
305
306
307
async def _process_callback(self, callback: Callable[[], Any]) -> None:
308
# Callback is an async coroutine, need to await it
- await callback()
309
+ if inspect.iscoroutinefunction(callback):
310
+ await callback()
311
+ else:
312
+ # Callback is a sync function, such as _flush_client_reports()
313
+ callback()
314
315
def _on_task_complete(self, task: asyncio.Task[None]) -> None:
316
try:
0 commit comments