|
|
@ -4,7 +4,6 @@ import ( |
|
|
|
"encoding/json" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"strings" |
|
|
|
|
|
|
|
"sync" |
|
|
|
"sync" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
) |
|
|
|
) |
|
|
@ -398,8 +397,9 @@ func (s *Semaphore) pruneDeadHolders(lock *semaphoreLock, pairs KVPairs) { |
|
|
|
// Gather all the live holders
|
|
|
|
// Gather all the live holders
|
|
|
|
alive := make(map[string]struct{}, len(pairs)) |
|
|
|
alive := make(map[string]struct{}, len(pairs)) |
|
|
|
for _, pair := range pairs { |
|
|
|
for _, pair := range pairs { |
|
|
|
session := strings.TrimPrefix(pair.Key, s.opts.Prefix) |
|
|
|
if pair.Session != "" { |
|
|
|
alive[session] = struct{}{} |
|
|
|
alive[pair.Session] = struct{}{} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Remove any holders that are dead
|
|
|
|
// Remove any holders that are dead
|
|
|
|