diff --git a/relay-server/src/endpoints/common.rs b/relay-server/src/endpoints/common.rs index b9a82b7b1e..45c990a2b8 100644 --- a/relay-server/src/endpoints/common.rs +++ b/relay-server/src/endpoints/common.rs @@ -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)?; diff --git a/relay-server/src/services/buffer/mod.rs b/relay-server/src/services/buffer/mod.rs index b3fa13b634..9d622e84c0 100644 --- a/relay-server/src/services/buffer/mod.rs +++ b/relay-server/src/services/buffer/mod.rs @@ -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,