mirror of
https://github.com/mailgun/groupcache.git
synced 2024-11-16 14:10:04 +00:00
Logging.
This commit is contained in:
parent
ce9ee26851
commit
73db6704c7
@ -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
10
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)
|
||||
|
Loading…
Reference in New Issue
Block a user