Skip to content
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

ref(projects): Prefetch sampling project #4201

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion relay-server/src/endpoints/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,20 @@ pub async fn handle_envelope(
return Ok(event_id);
}

let project_key = managed_envelope.envelope().meta().public_key();

// Prefetch sampling project key, current spooling implementations rely on this behavior.
//
// To be changed once spool v1 has been removed.
if let Some(sampling_project_key) = managed_envelope.envelope().sampling_key() {
if sampling_project_key != project_key {
state.project_cache_handle().fetch(sampling_project_key);
}
}

let checked = state
.project_cache_handle()
.get(managed_envelope.scoping().project_key)
.get(project_key)
.check_envelope(managed_envelope)
.map_err(BadStoreRequest::EventRejected)?;

Expand Down
1 change: 1 addition & 0 deletions relay-server/src/services/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ impl EnvelopeBufferService {
// avoid flooding the project cache with `UpdateProject` messages.
if Instant::now() >= next_project_fetch {
relay_log::trace!("EnvelopeBufferService: requesting project(s) update");

let ProjectKeyPair {
own_key,
sampling_key,
Expand Down
Loading