From 4a038927ee136e409f87aed4f81f2e0dd56b0cc3 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 be939c82dd..88f4b59cce 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