Skip to content

Commit

Permalink
fix(spooler): Proactively move on-disk spool to memory when it fits (#…
Browse files Browse the repository at this point in the history
…2949)

To make sure that we switch to in-memory spool faster we can proactively
check if the size of the on-disk data fits into memory and move the
spooled envelopes in one go to memory.

- this will ensure that we eventually switch to in-memory spool, even
though there are still some envelopes left unspooled
- this PR also makes sure to use better estimate of the used disk size
for the spooled envelopes
- the test is updated to account for the change mentioned above
  • Loading branch information
olksdr committed Jan 18, 2024
1 parent ba844dc commit d3864a0
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 45 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

**Internal**:

- Proactively move on-disk spool to memory. ([#2949](https://github.com/getsentry/relay/pull/2949))

**Bug Fixes**:

- Add automatic PII scrubbing to `logentry.params`. ([#2956](https://github.com/getsentry/relay/pull/2956))
Expand Down
4 changes: 3 additions & 1 deletion relay-server/src/actors/project_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,8 @@ mod tests {

#[tokio::test]
async fn always_spools() {
relay_log::init_test!();

let num_permits = 5;
let buffer_guard: Arc<_> = BufferGuard::new(num_permits).into();
let services = mocked_services();
Expand Down Expand Up @@ -1194,7 +1196,7 @@ mod tests {
));
tokio::time::sleep(Duration::from_millis(100)).await;

// We should be able to unspool once since we have 1 permit.
// We should be able to unspool 5 envelopes since we have 5 permits.
let mut envelopes = vec![];
while let Ok(envelope) = rx.try_recv() {
envelopes.push(envelope)
Expand Down
Loading

0 comments on commit d3864a0

Please sign in to comment.