Skip to content

Commit ad93516

Browse files
committed
Merge branch 'srothh/async-transport' into srothh/async-transport-integration
2 parents 55b606a + ef61134 commit ad93516

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sentry_sdk/worker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import threading
55
import asyncio
6+
import inspect
67

78
from time import sleep, time
89
from sentry_sdk._queue import Queue, FullError
@@ -305,7 +306,11 @@ async def _target(self) -> None:
305306

306307
async def _process_callback(self, callback: Callable[[], Any]) -> None:
307308
# Callback is an async coroutine, need to await it
308-
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()
309314

310315
def _on_task_complete(self, task: asyncio.Task[None]) -> None:
311316
try:

0 commit comments

Comments
 (0)