]> git.giacomolli.uk - onechat/blobdiff - whatsapp_groups.go
Format short daemon events with slog
[onechat] / whatsapp_groups.go
index e8111c30864e278bcdcfac07c2654c2ce6bc1cba..56676e5264fb363e709b2785bd095c6c9d42c012 100644 (file)
@@ -49,6 +49,7 @@ type WhatsAppGroups struct {
 // again, at most once in whatsappGroupsRefresh.
 func (g *WhatsAppGroups) name(ctx context.Context, link WhatsAppLink, id string) string {
        g.mutex.Lock()
 // again, at most once in whatsappGroupsRefresh.
 func (g *WhatsAppGroups) name(ctx context.Context, link WhatsAppLink, id string) string {
        g.mutex.Lock()
+
        name, found := g.names[id]
        fresh := time.Since(g.triedAt) < whatsappGroupsRefresh
        g.mutex.Unlock()
        name, found := g.names[id]
        fresh := time.Since(g.triedAt) < whatsappGroupsRefresh
        g.mutex.Unlock()
@@ -57,6 +58,7 @@ func (g *WhatsAppGroups) name(ctx context.Context, link WhatsAppLink, id string)
                g.read(ctx, link)
 
                g.mutex.Lock()
                g.read(ctx, link)
 
                g.mutex.Lock()
+
                name, found = g.names[id]
                g.mutex.Unlock()
        }
                name, found = g.names[id]
                g.mutex.Unlock()
        }
@@ -80,7 +82,7 @@ func (g *WhatsAppGroups) read(ctx context.Context, link WhatsAppLink) bool {
 
        groups, err := link.client.GetJoinedGroups(ctx)
        if err != nil {
 
        groups, err := link.client.GetJoinedGroups(ctx)
        if err != nil {
-               g.logger.Printf("group names can be missing, because the list of groups did not load: %s", whatsappRedact(link.own, err.Error()))
+               g.logger.Printf("group list failed: %s", whatsappRedact(link.own, err.Error()))
        }
 
        g.mutex.Lock()
        }
 
        g.mutex.Lock()