From 0a116fb51ab4f725b5cc7083d2ca6c7fbeb8057f Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Mon, 2 Oct 2023 17:03:07 +0200 Subject: [PATCH] Stale, not State --- userapi/internal/device_list_update.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/userapi/internal/device_list_update.go b/userapi/internal/device_list_update.go index a8d347eac..ea5608468 100644 --- a/userapi/internal/device_list_update.go +++ b/userapi/internal/device_list_update.go @@ -183,7 +183,7 @@ func (u *DeviceListUpdater) Start() error { // Filter out dupe domains, as processServer is going to get all users anyway seenDomains := make(map[spec.ServerName]struct{}) - newStateLists := make([]string, 0, len(staleLists)) + newStaleLists := make([]string, 0, len(staleLists)) for _, userID := range staleLists { _, domain, err := gomatrixserverlib.SplitID('@', userID) if err != nil { @@ -193,14 +193,14 @@ func (u *DeviceListUpdater) Start() error { if _, ok := seenDomains[domain]; ok { continue } - newStateLists = append(newStateLists, userID) + newStaleLists = append(newStaleLists, userID) seenDomains[domain] = struct{}{} } offset, step := time.Second*10, time.Second - if max := len(newStateLists); max > 120 { + if max := len(newStaleLists); max > 120 { step = (time.Second * 120) / time.Duration(max) } - for _, userID := range newStateLists { + for _, userID := range newStaleLists { userID := userID // otherwise we are only sending the last entry time.AfterFunc(offset, func() { u.notifyWorkers(userID)