Skip to content

Commit aa17af4

Browse files
authored
fix: Don't block on sending envelopes (#546)
1 parent 3e7eec2 commit aa17af4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
**Fixes**:
6+
7+
- Envelopes will be discarded rather than blocking if the transport channel fills up. ([#546](https://github.com/getsentry/sentry-rust/pull/546))
8+
39
## 0.29.2
410

511
### Various fixes & improvements

sentry/src/transports/tokio_thread.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ impl TransportThread {
8585
}
8686

8787
pub fn send(&self, envelope: Envelope) {
88-
let _ = self.sender.send(Task::SendEnvelope(envelope));
88+
// Using send here would mean that when the channel fills up for whatever
89+
// reason, trying to send an envelope would block everything. We'd rather
90+
// drop the envelope in that case.
91+
if let Err(e) = self.sender.try_send(Task::SendEnvelope(envelope)) {
92+
sentry_debug!("envelope dropped: {e}");
93+
}
8994
}
9095

9196
pub fn flush(&self, timeout: Duration) -> bool {

0 commit comments

Comments
 (0)