Skip to content

Commit

Permalink
Merge pull request #2285 from SimonCqk/master
Browse files Browse the repository at this point in the history
remove redundant code.
  • Loading branch information
allencloud authored Sep 29, 2018
2 parents ad89fa2 + e145421 commit 8be6286
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/kmutex/kmutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,14 @@ func New() *KMutex {
for {
<-ticker.C

var removes []string

m.Mutex.Lock()

for k, v := range m.keys {
if v.waits == 0 {
removes = append(removes, k)
delete(m.keys, k)
close(v.c)
}
}
for _, k := range removes {
delete(m.keys, k)
}

m.Mutex.Unlock()
}
Expand Down

0 comments on commit 8be6286

Please sign in to comment.