fix deadlock on failed cluster sync
This commit is contained in:
@@ -35,6 +35,7 @@ func Run() {
|
||||
cluster := Cluster{}
|
||||
cluster.Init(client)
|
||||
start := time.Now()
|
||||
log.Printf("[INFO] starting cluster sync\n")
|
||||
err := cluster.Sync()
|
||||
if err != nil {
|
||||
log.Printf("[Error] error encountered while syncing cluster: %s", err)
|
||||
|
||||
@@ -36,6 +36,7 @@ func (cluster *Cluster) Sync() error {
|
||||
// get all nodes
|
||||
nodes, err := cluster.pve.Nodes()
|
||||
if err != nil {
|
||||
cluster.lock.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -56,6 +57,7 @@ func (cluster *Cluster) Sync() error {
|
||||
|
||||
err = wg.Wait()
|
||||
if err != nil {
|
||||
cluster.lock.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user