diff --git a/groupcache.go b/groupcache.go index 5ea4c5f..75812b5 100644 --- a/groupcache.go +++ b/groupcache.go @@ -298,12 +298,6 @@ func (g *Group) Remove(ctx context.Context, key string) error { g.peersOnce.Do(g.initPeers) _, err := g.removeGroup.Do(key, func() (interface{}, error) { - var peerList []string - for _, peer := range g.peers.GetAll() { - peerList = append(peerList, peer.GetURL()) - } - logrus.WithField("name", g.name).Infof("Group.Remove() peers:%+v", peerList) - // Remove from key owner first owner, ok := g.peers.PickPeer(key) if ok { diff --git a/http.go b/http.go index 32e1f90..8b04ae9 100644 --- a/http.go +++ b/http.go @@ -32,6 +32,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/mailgun/groupcache/v2/consistenthash" pb "github.com/mailgun/groupcache/v2/groupcachepb" + "github.com/sirupsen/logrus" ) const defaultBasePath = "/_groupcache/" @@ -187,6 +188,15 @@ func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) { group.Stats.ServerRequests.Add(1) + var peerList []string + for _, peer := range group.peers.GetAll() { + peerList = append(peerList, peer.GetURL()) + } + logrus.WithFields(logrus.Fields{ + "name": groupName, + "peers": strings.Join(peerList, ","), + }).Infof("HTTPPool.ServeHTTP() %s %s", r.Method, r.URL.String()) + // Delete the key and return 200 if r.Method == http.MethodDelete { group.localRemove(key)