mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
Stale, not State
This commit is contained in:
parent
688129fbcb
commit
0a116fb51a
|
|
@ -183,7 +183,7 @@ func (u *DeviceListUpdater) Start() error {
|
||||||
|
|
||||||
// Filter out dupe domains, as processServer is going to get all users anyway
|
// Filter out dupe domains, as processServer is going to get all users anyway
|
||||||
seenDomains := make(map[spec.ServerName]struct{})
|
seenDomains := make(map[spec.ServerName]struct{})
|
||||||
newStateLists := make([]string, 0, len(staleLists))
|
newStaleLists := make([]string, 0, len(staleLists))
|
||||||
for _, userID := range staleLists {
|
for _, userID := range staleLists {
|
||||||
_, domain, err := gomatrixserverlib.SplitID('@', userID)
|
_, domain, err := gomatrixserverlib.SplitID('@', userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -193,14 +193,14 @@ func (u *DeviceListUpdater) Start() error {
|
||||||
if _, ok := seenDomains[domain]; ok {
|
if _, ok := seenDomains[domain]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
newStateLists = append(newStateLists, userID)
|
newStaleLists = append(newStaleLists, userID)
|
||||||
seenDomains[domain] = struct{}{}
|
seenDomains[domain] = struct{}{}
|
||||||
}
|
}
|
||||||
offset, step := time.Second*10, time.Second
|
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)
|
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
|
userID := userID // otherwise we are only sending the last entry
|
||||||
time.AfterFunc(offset, func() {
|
time.AfterFunc(offset, func() {
|
||||||
u.notifyWorkers(userID)
|
u.notifyWorkers(userID)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue