mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
global mutex on GetPorts
This commit is contained in:
parent
a100a38b4a
commit
36f17eee1d
3 changed files with 12 additions and 6 deletions
|
|
@ -103,9 +103,9 @@ func (e *Etcd) Close() error {
|
|||
if e.heartbeatCancel != nil {
|
||||
e.heartbeatCancel()
|
||||
}
|
||||
e.e.Server.Stop()
|
||||
e.e.Close()
|
||||
<-e.e.Server.StopNotify()
|
||||
// e.e.Server.Stop()
|
||||
// e.e.Close()
|
||||
// <-e.e.Server.StopNotify()
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -692,9 +692,9 @@ func (s *Server) Close() error {
|
|||
errc = s.cluster.close()
|
||||
}
|
||||
errhs = s.syncer.stopTranslationSync()
|
||||
// if s.disCo != nil {
|
||||
// errd = s.disCo.Close()
|
||||
// }
|
||||
if s.disCo != nil {
|
||||
errd = s.disCo.Close()
|
||||
}
|
||||
if s.holder != nil {
|
||||
errh = s.holder.Close()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import (
|
|||
"log"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
|
|
@ -31,7 +32,12 @@ func GetPort(wrapper func(int) error, retries int) error {
|
|||
return GetPorts(f, 1, retries)
|
||||
}
|
||||
|
||||
var mu = &sync.Mutex{}
|
||||
|
||||
func GetPorts(wrapper func([]int) error, requestedPorts, retries int) error {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
for i := 0; i < retries; i++ {
|
||||
// get all requested ports
|
||||
listeners := make([]net.Listener, requestedPorts)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue