Skip to content

Commit 7d23f75

Browse files
author
Aaron Schlesinger
committed
fix(pkg/sshd): remove global mutex lock
this lock was used as a test to verify that the global cleaner lock was correct, and was accidentally checked in. removing this to go back to the old behavior
1 parent 54682c9 commit 7d23f75

2 files changed

Lines changed: 7 additions & 20 deletions

File tree

pkg/sshd/lock.go

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,12 @@ type RepositoryLock interface {
2020
Unlock(repoName string, timeout time.Duration) error
2121
}
2222

23-
type mutexLock struct {
24-
mut *sync.Mutex
25-
}
26-
27-
func (m *mutexLock) Lock(string, time.Duration) error {
28-
m.mut.Lock()
29-
return nil
30-
}
31-
32-
func (m *mutexLock) Unlock(string, time.Duration) error {
33-
m.mut.Unlock()
34-
return nil
35-
}
36-
3723
// NewInMemoryRepositoryLock returns a new instance of a RepositoryLock
3824
func NewInMemoryRepositoryLock() RepositoryLock {
39-
return &mutexLock{mut: new(sync.Mutex)}
40-
// return &inMemoryRepoLock{
41-
// mutex: &sync.RWMutex{},
42-
// dataMap: make(map[string]bool),
43-
// }
25+
return &inMemoryRepoLock{
26+
mutex: &sync.RWMutex{},
27+
dataMap: make(map[string]bool),
28+
}
4429
}
4530

4631
type inMemoryRepoLock struct {

pkg/sshd/server_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/deis/builder/pkg/controller"
99

1010
"github.com/Masterminds/cookoo"
11+
"github.com/deis/builder/pkg/cleaner"
1112
"golang.org/x/crypto/ssh"
1213
)
1314

@@ -269,8 +270,9 @@ func runServer(config *ssh.ServerConfig, c *Circuit, pushLock RepositoryLock, de
269270
},
270271
})
271272

273+
cleanerRef := cleaner.NewRef()
272274
go func() {
273-
if err := Serve(reg, router, c, gitHome, pushLock, deleteLock, cxt); err != nil {
275+
if err := Serve(reg, router, c, gitHome, pushLock, cleanerRef, cxt); err != nil {
274276
t.Fatalf("Failed serving with %s", err)
275277
}
276278
}()

0 commit comments

Comments
 (0)