aboutsummaryrefslogtreecommitdiff
path: root/keyserver
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-04-04 15:14:10 +0100
committerGitHub <noreply@github.com>2022-04-04 15:14:10 +0100
commit9b316ac64ce4ff0abee497e9c69204c4eb9102eb (patch)
treeaebf6fe7c32f20858acc0b10596cd7eced42510a /keyserver
parent6748a2a823fe5923368371ef7a109d856a177441 (diff)
Slower federation warm-up (#2320)
* Wake destination queues gradually, rather than all at once * Delay device list updates too * Maximum two minute warmup period
Diffstat (limited to 'keyserver')
-rw-r--r--keyserver/internal/device_list_update.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/keyserver/internal/device_list_update.go b/keyserver/internal/device_list_update.go
index 4b2b8c18..561c9a16 100644
--- a/keyserver/internal/device_list_update.go
+++ b/keyserver/internal/device_list_update.go
@@ -157,8 +157,15 @@ func (u *DeviceListUpdater) Start() error {
if err != nil {
return err
}
+ offset, step := time.Second*10, time.Second
+ if max := len(staleLists); max > 120 {
+ step = (time.Second * 120) / time.Duration(max)
+ }
for _, userID := range staleLists {
- u.notifyWorkers(userID)
+ time.AfterFunc(offset, func() {
+ u.notifyWorkers(userID)
+ })
+ offset += step
}
return nil
}