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")
|
logger := m.logger.Named("messageSegmentsCleanupLoop")
|
||||||
|
|
||||||
go func() {
|
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 {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-time.After(interval):
|
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
|
interval = 1 * time.Hour
|
||||||
|
|
||||||
err := m.sender.CleanupSegments()
|
err := m.sender.CleanupSegments()
|
||||||
|
|
Loading…
Reference in New Issue