This commit is contained in:
Shawn Poulson 2024-06-26 16:33:56 -04:00
parent ce9ee26851
commit 73db6704c7
2 changed files with 10 additions and 6 deletions

View File

@ -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 {

10
http.go
View File

@ -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)