Skip to content

Commit

Permalink
fix(s3stream): add min compaction delay (#918)
Browse files Browse the repository at this point in the history
Signed-off-by: Shichao Nie <[email protected]>
  • Loading branch information
SCNieh authored Feb 4, 2024
1 parent c341448 commit 6fe3ebf
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.slf4j.Logger;

public class CompactionManager {
private static final int MIN_COMPACTION_DELAY_MS = 60000;
private final Logger logger;
private final Logger s3ObjectLogger;
private final ObjectManager objectManager;
Expand Down Expand Up @@ -129,7 +130,7 @@ private void scheduleNextCompaction(long delayMillis) {
} catch (Exception ex) {
logger.error("Error while compacting objects ", ex);
}
long nextDelay = Math.max(0, (long) this.compactionInterval * 60 * 1000 - timerUtil.elapsedAs(TimeUnit.MILLISECONDS));
long nextDelay = Math.max(MIN_COMPACTION_DELAY_MS, (long) this.compactionInterval * 60 * 1000 - timerUtil.elapsedAs(TimeUnit.MILLISECONDS));
scheduleNextCompaction(nextDelay);
}, delayMillis, TimeUnit.MILLISECONDS);
}
Expand Down

0 comments on commit 6fe3ebf

Please sign in to comment.