chore: delay message segments cleanup loop execution
This commit is contained in:
parent
b6ade53603
commit
dd5e45d81c
|
@ -5730,11 +5730,12 @@ func (m *Messenger) startMessageSegmentsCleanupLoop() {
|
|||
logger := m.logger.Named("messageSegmentsCleanupLoop")
|
||||
|
||||
go func() {
|
||||
var interval time.Duration = 0
|
||||
// Delay by a few minutes to minimize messenger's startup time
|
||||
var interval time.Duration = 5 * time.Minute
|
||||
for {
|
||||
select {
|
||||
case <-time.After(interval):
|
||||
// Immediate execution on first run, then set to regular interval
|
||||
// Set the regular interval after the first execution
|
||||
interval = 1 * time.Hour
|
||||
|
||||
err := m.sender.CleanupSegments()
|
||||
|
|
Loading…
Reference in New Issue