Maximum two minute warmup period

This commit is contained in:
Neil Alexander 2022-04-04 15:10:33 +01:00
parent d45e629460
commit f24333ecd2
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 10 additions and 4 deletions

View file

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

View file

@ -157,12 +157,15 @@ func (u *DeviceListUpdater) Start() error {
if err != nil {
return err
}
offset := time.Second * 10
offset, step := time.Second*10, time.Second
if max := len(staleLists); max > 120 {
step = (time.Second * 120) / time.Duration(max)
}
for _, userID := range staleLists {
time.AfterFunc(offset, func() {
u.notifyWorkers(userID)
})
offset += time.Second
offset += step
}
return nil
}