Skip to content

Commit 68fb0b4

Browse files
untitakersentry-bot
and
sentry-bot
authored
fix(worker): Log data-dropping events with error (#1032)
Co-authored-by: sentry-bot <[email protected]>
1 parent b9cdcd6 commit 68fb0b4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sentry_sdk/worker.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ def _wait_flush(self, timeout, callback):
9999
# type: (float, Optional[Any]) -> None
100100
initial_timeout = min(0.1, timeout)
101101
if not self._timed_queue_join(initial_timeout):
102-
pending = self._queue.qsize()
102+
pending = self._queue.qsize() + 1
103103
logger.debug("%d event(s) pending on flush", pending)
104104
if callback is not None:
105105
callback(pending, timeout)
106-
self._timed_queue_join(timeout - initial_timeout)
106+
107+
if not self._timed_queue_join(timeout - initial_timeout):
108+
pending = self._queue.qsize() + 1
109+
logger.error("flush timed out, dropped %s events", pending)
107110

108111
def submit(self, callback):
109112
# type: (Callable[[], None]) -> None
@@ -115,7 +118,7 @@ def submit(self, callback):
115118

116119
def on_full_queue(self, callback):
117120
# type: (Optional[Any]) -> None
118-
logger.debug("background worker queue full, dropping event")
121+
logger.error("background worker queue full, dropping event")
119122

120123
def _target(self):
121124
# type: () -> None

0 commit comments

Comments
 (0)