Delay device list updates too

This commit is contained in:
Neil Alexander 2022-04-04 13:21:36 +01:00
parent be24eea797
commit d45e629460
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 8 additions and 4 deletions

View file

@ -119,11 +119,11 @@ func NewOutgoingQueues(
} else {
log.WithError(err).Error("Failed to get EDU server names for destination queue hydration")
}
offset := time.Duration(5)
offset := time.Second * 5
for serverName := range serverNames {
if queue := queues.getQueue(serverName); queue != nil {
time.AfterFunc(time.Second*offset, queue.wakeQueueIfNeeded)
offset++
time.AfterFunc(offset, queue.wakeQueueIfNeeded)
offset += time.Second
}
}
}

View file

@ -157,8 +157,12 @@ func (u *DeviceListUpdater) Start() error {
if err != nil {
return err
}
offset := time.Second * 10
for _, userID := range staleLists {
u.notifyWorkers(userID)
time.AfterFunc(offset, func() {
u.notifyWorkers(userID)
})
offset += time.Second
}
return nil
}