From 249c1c1132e3cf9ff833264b748e65ee25866371 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 7 Oct 2022 03:02:35 +0200 Subject: [PATCH] Don't notify clients when description is unchanged. When we fixed the handling of autolocked groups, we introduced a bug where we spuriously notify clients even when the description didn't change. --- group/group.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/group/group.go b/group/group.go index a4315ec..04b9564 100644 --- a/group/group.go +++ b/group/group.go @@ -438,9 +438,11 @@ func add(name string, desc *Description) (*Group, []Client, error) { g.mu.Lock() defer g.mu.Unlock() + notify := false if desc != nil { if !descriptionMatch(g.description, desc) { g.description = desc + notify = true } } else if !descriptionUnchanged(name, g.description) { desc, err = readDescription(name) @@ -452,11 +454,16 @@ func add(name string, desc *Description) (*Group, []Client, error) { return nil, nil, err } g.description = desc + notify = true } autoLockKick(g) - return g, g.getClientsUnlocked(nil), nil + var clients []Client + if notify { + clients = g.getClientsUnlocked(nil) + } + return g, clients, nil } func Range(f func(g *Group) bool) {