From 0ceeec9be3acd07cda24d849d7cd71dc4c0ac3cc Mon Sep 17 00:00:00 2001 From: "Alex Chi Z." <4198311+skyzh@users.noreply.github.com> Date: Wed, 5 Feb 2025 17:11:50 -0500 Subject: [PATCH] fix(pageserver): schedule compaction immediately if pending (#10684) ## Problem The code is intended to reschedule compaction immediately if there are pending tasks. We set the duration to 0 before if there are pending tasks, but this will go through the `if period == Duration::ZERO {` branch and sleep for another 10 seconds. ## Summary of changes Set duration to 1 so that it doesn't sleep for too long. Signed-off-by: Alex Chi Z --- pageserver/src/tenant/tasks.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pageserver/src/tenant/tasks.rs b/pageserver/src/tenant/tasks.rs index b6b64d02dd9f..d65f0991820d 100644 --- a/pageserver/src/tenant/tasks.rs +++ b/pageserver/src/tenant/tasks.rs @@ -211,7 +211,7 @@ async fn compaction_loop(tenant: Arc, cancel: CancellationToken) { error_run_count = 0; // schedule the next compaction immediately in case there is a pending compaction task sleep_duration = if let CompactionOutcome::Pending = outcome { - Duration::ZERO + Duration::from_secs(1) } else { period };