Repository navigation
ref: Rewrite Transports to be able to explicitly flush - #314
Merged
Merged
Conversation
flub
reviewed
Feb 1, 2021
| /// Updates the RateLimiter with information from a `Retry-After` header. | ||
| pub fn update_from_retry_after(&mut self, header: &str) { | ||
| let new_time = if let Ok(value) = header.parse::<f64>() { | ||
| Some(SystemTime::now() + Duration::from_secs(value.ceil() as u64)) |
Contributor
There was a problem hiding this comment.
Why is rate limiting done with SystemTime rather than Instant?
Contributor
Author
There was a problem hiding this comment.
Not quite sure actually. I just copied the old code, without thinking too much about it.
Swatinem
marked this pull request as ready for review
February 3, 2021 11:58
flub
approved these changes
Feb 3, 2021
szokeasaurusrex
added a commit
that referenced
this pull request
Nov 3, 2026
The `Transport` impl for `Arc<T>` forwarded `send_envelope` and `shutdown` but not `flush`, so flushing through it hit the trait default and returned `true` without flushing `T`. This also affects `Client::flush` when passing an `Arc`-wrapped transport to `ClientOptions::transport`, as in `.transport(Arc::new(TestTransport::new()))`. `flush` was added to the trait in #314 without updating this impl. `clippy::missing_trait_methods` is denied on the impl so a future defaulted `Transport` method cannot be silently skipped again. Fixes #1374 Fixes [RUST-302](https://linear.app/getsentry/issue/RUST-302) <!-- junior-request-attribution:start --> via @szokeasaurusrex. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0C01CK9SG2%3A1793270064.615489 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C01CK9SG2%3A1793270064.615489) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C01CK9SG2%3A1793270064.615489/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Dr. Daniel Szokenstein <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements a new
flushmethod for Transports which can flush the current queue without closing the transport.Also, the default transports were rewritten in a more generic way using an async-capable background thread.
Additionally, the internal transports now support more fine grained rate limiting via
X-Sentry-Rate-Limits. TheRateLimiteris currently private, but we can decide how to best expose it later on.TODO
RateLimiterby value instead of&mut.