Skip to content

Commit

Permalink
fixed issue where lock was not being allocated for given service but …
Browse files Browse the repository at this point in the history
…for the same key
  • Loading branch information
ChrisMcKenzie committed Nov 4, 2015
1 parent dd69256 commit 8a27e4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lock/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lock

import (
"os"
"path/filepath"

"github.com/hashicorp/consul/api"
)
Expand All @@ -17,7 +18,7 @@ func NewConsulLocker(prefix string, config *api.Config) (*ConsulLocker, error) {
}
name, _ := os.Hostname()
s, err := client.SemaphoreOpts(&api.SemaphoreOptions{
Prefix: "dropship/services/",
Prefix: filepath.Join("dropship/services/", prefix),
Limit: 1,

SessionName: name,
Expand Down
2 changes: 1 addition & 1 deletion lock/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
)

func TestMain(t *testing.T) {
locker, err = NewConsulLocker("dropship/services", api.DefaultConfig())
locker, err = NewConsulLocker("dropship", api.DefaultConfig())
if err != nil {
t.Error(err)
t.Fail()
Expand Down

0 comments on commit 8a27e4e

Please sign in to comment.