diff --git a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java index 329211b237b..5634502152a 100644 --- a/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java +++ b/services/chainstorage/src/main/java/tech/pegasys/teku/services/chainstorage/StorageService.java @@ -18,6 +18,7 @@ import com.google.common.annotations.VisibleForTesting; import java.nio.file.Path; +import java.time.Duration; import java.util.Optional; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -134,12 +135,16 @@ protected SafeFuture doStart() { configureStatePruner( config.getRetainedSlots(), storagePrunerAsyncRunner, + config.getStatePruningInterval(), + config.getStatePruningLimit(), pruningTimingsLabelledGauge, pruningActiveLabelledGauge); } else if (!config.getDataStorageMode().storesFinalizedStates()) { configureStatePruner( StorageConfiguration.DEFAULT_STORAGE_RETAINED_SLOTS, storagePrunerAsyncRunner, + Duration.ofMinutes(1), + 1, pruningTimingsLabelledGauge, pruningActiveLabelledGauge); } @@ -221,6 +226,8 @@ protected SafeFuture doStart() { void configureStatePruner( final long slotsToRetain, final AsyncRunner storagePrunerAsyncRunner, + final Duration pruningInterval, + final int pruningLimit, final SettableLabelledGauge pruningTimingsLabelledGauge, final SettableLabelledGauge pruningActiveLabelledGauge) { if (config.getDataStorageCreateDbVersion() == DatabaseVersion.LEVELDB_TREE) { @@ -240,9 +247,9 @@ void configureStatePruner( config.getSpec(), database, storagePrunerAsyncRunner, - config.getStatePruningInterval(), + pruningInterval, slotsToRetain, - config.getStatePruningLimit(), + pruningLimit, "state", pruningTimingsLabelledGauge, pruningActiveLabelledGauge));