From 229ee483cbcc3aa2118f538741fbdfa07e29e8dd Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 13 Jan 2015 11:50:57 -0800 Subject: [PATCH] api: More reliable session check --- api/semaphore.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/semaphore.go b/api/semaphore.go index be939c82d..88f4b59cc 100644 --- a/api/semaphore.go +++ b/api/semaphore.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "path" - "strings" "sync" "time" ) @@ -398,8 +397,9 @@ func (s *Semaphore) pruneDeadHolders(lock *semaphoreLock, pairs KVPairs) { // Gather all the live holders alive := make(map[string]struct{}, len(pairs)) for _, pair := range pairs { - session := strings.TrimPrefix(pair.Key, s.opts.Prefix) - alive[session] = struct{}{} + if pair.Session != "" { + alive[pair.Session] = struct{}{} + } } // Remove any holders that are dead