diff --git a/eclair-core/src/main/resources/reference.conf b/eclair-core/src/main/resources/reference.conf index a6b71251d3..abc85ca8e4 100644 --- a/eclair-core/src/main/resources/reference.conf +++ b/eclair-core/src/main/resources/reference.conf @@ -584,9 +584,10 @@ eclair { // down the node, we delete those rows in batches at regular intervals. revoked-htlc-info-cleaner { // Number of rows to delete per batch: a higher value will clean up the DB faster, but may have a higher impact on performance. - batch-size = 50000 + batch-size = 500 // Frequency at which batches of rows are deleted: a lower value will clean up the DB faster, but may have a higher impact on performance. - interval = 15 minutes + // If you are frequently closing or splicing channels, you may want to increase the default interval if you're seeing IO performance issues. + interval = 1 seconds } } diff --git a/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala b/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala index 98cc460914..29acfd6614 100644 --- a/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala +++ b/eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala @@ -43,13 +43,16 @@ object RevokedHtlcInfoCleaner { Behaviors.setup { context => context.system.eventStream ! EventStream.Subscribe(context.self) Behaviors.withTimers { timers => - timers.startTimerWithFixedDelay(DeleteBatch, config.interval) + timers.startSingleTimer(DeleteBatch, config.interval) Behaviors.receiveMessage { case ForgetHtlcInfos(channelId, beforeCommitIndex) => db.markHtlcInfosForRemoval(channelId, beforeCommitIndex) Behaviors.same case DeleteBatch => db.removeHtlcInfos(config.batchSize) + // We restart a new timer after each batch, instead of using a timer at fixed intervals. + // This ensures that we don't have DeleteBatch messages queuing up in the mailbox when the DB is busy. + timers.startSingleTimer(DeleteBatch, config.interval) Behaviors.same } }