diff --git a/CHANGELOG.md b/CHANGELOG.md index 630235f9..9311f0bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +**Fixes**: + +- Envelopes will be discarded rather than blocking if the transport channel fills up. ([#546](https://github.com/getsentry/sentry-rust/pull/546)) + ## 0.29.2 ### Various fixes & improvements diff --git a/sentry/src/transports/tokio_thread.rs b/sentry/src/transports/tokio_thread.rs index 4a99a7a3..5ea1ae5e 100644 --- a/sentry/src/transports/tokio_thread.rs +++ b/sentry/src/transports/tokio_thread.rs @@ -85,7 +85,12 @@ impl TransportThread { } pub fn send(&self, envelope: Envelope) { - let _ = self.sender.send(Task::SendEnvelope(envelope)); + // Using send here would mean that when the channel fills up for whatever + // reason, trying to send an envelope would block everything. We'd rather + // drop the envelope in that case. + if let Err(e) = self.sender.try_send(Task::SendEnvelope(envelope)) { + sentry_debug!("envelope dropped: {e}"); + } } pub fn flush(&self, timeout: Duration) -> bool {