-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(project): Add backoff mechanism for fetching projects #1726
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a test for this behavior? Something like
relay/tests/integration/test_query.py
Line 63 in e87b92e
def test_project_grace_period(mini_sentry, relay, grace_period): |
relay-server/src/actors/project.rs
Outdated
// If the new state is valid or the old one is expired, always use the new one. | ||
_ => self.state = Some(state.clone()), | ||
// And also reset the backoff at this point. | ||
_ => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when self.expiry_state()
is Expired
, but the new state
is invalid()
? Shouldn't we then also set a next_fetch_attempt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently (and the behaviour we had before) once the old state expires we save anything we get from upstream - this case the upstream is alive, just delivers the invalid state. Since we cannot use the old state either, we will just try to request the new one soon-ish again.
Do you think we have to re-think this behaviour in this PR?
Not sure about the test. I do not really want to introduce more "waits" in already slow integration tests. |
In case of getting invalid project we try to reuse the stale state and make sure to initiate the backoff to slow down the requests to the project cache, so we don't ddos out own service. We reset the backoff only when the new state is accepted.
* master: (35 commits) ref(actix): Migrate ProjectUpstream to `relay_system::Service` (#1727) feat(general): Add unknown SessionStatus variant (#1736) ref: Convert integration tests about dropping transactions to unit tests (#1720) release: 0.8.16 ci: Skip redundant self-hosted E2E on library release (#1755) doc(changelog): Add relevant changes to python changelog (#1753) feat(profiling): Add profile context (#1748) release: 23.1.0 profiling(fix): use an unpadded base64 encoding (#1749) Revert "feat(replays): Enable PII scrubbing for all organizations" (#1747) feat: Switch from base64 to data-encoding (#1743) instr(replays): Add timer metric to recording processing (#1742) feat(replays): Use Annotated struct definition for replay-event parsing (#1582) feat(sessions): Retire session duration metric (#1739) feat(general): Scrub all fields with IP address (#1725) feat(replays): Enable PII scrubbing for all organizations (#1678) chore(project): Add backoff mechanism for fetching projects (#1726) feat(profiling): Add new measurement units for profiling (#1732) chore(toolchain): update rust to 1.66.1 (#1735) ref(actix): Migrate server actor to the "service" arch (#1723) ...
In case of getting invalid project we try to reuse the stale state and make sure to initiate the backoff to slow down the requests to the project cache, so we don't ddos out own service.
We reset the backoff only when the new state is accepted.
closes: #1633