This commit is contained in:
Shawn Poulson 2024-06-26 17:00:27 -04:00
parent 73db6704c7
commit 18965b4c54

View File

@ -28,6 +28,7 @@ import (
"context"
"errors"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
@ -297,6 +298,16 @@ func (g *Group) Set(ctx context.Context, key string, value []byte, expire time.T
func (g *Group) Remove(ctx context.Context, key string) error {
g.peersOnce.Do(g.initPeers)
var peerList []string
for _, peer := range g.peers.GetAll() {
peerList = append(peerList, peer.GetURL())
}
logrus.WithFields(logrus.Fields{
"name": g.name,
"peers": strings.Join(peerList, ","),
"key": key,
}).Info("Group.Remove()")
_, err := g.removeGroup.Do(key, func() (interface{}, error) {
// Remove from key owner first
owner, ok := g.peers.PickPeer(key)