Skip to content

Commit 209c21e

Browse files
committed
Start timer after each batch delete
This ensures that we don't have messages queuing up in the mailbox when the DB is busy.
1 parent e955a93 commit 209c21e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/db/RevokedHtlcInfoCleaner.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ object RevokedHtlcInfoCleaner {
4343
Behaviors.setup { context =>
4444
context.system.eventStream ! EventStream.Subscribe(context.self)
4545
Behaviors.withTimers { timers =>
46-
timers.startTimerWithFixedDelay(DeleteBatch, config.interval)
46+
timers.startSingleTimer(DeleteBatch, config.interval)
4747
Behaviors.receiveMessage {
4848
case ForgetHtlcInfos(channelId, beforeCommitIndex) =>
4949
db.markHtlcInfosForRemoval(channelId, beforeCommitIndex)
5050
Behaviors.same
5151
case DeleteBatch =>
5252
db.removeHtlcInfos(config.batchSize)
53+
// We restart a new timer after each batch, instead of using a timer at fixed intervals.
54+
// This ensures that we don't have DeleteBatch messages queuing up in the mailbox when the DB is busy.
55+
timers.startSingleTimer(DeleteBatch, config.interval)
5356
Behaviors.same
5457
}
5558
}

0 commit comments

Comments
 (0)