fix deadlock on failed cluster sync

This commit is contained in:
2026-06-06 23:22:46 +00:00
parent 1b884008c5
commit 952b76c555
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ func Run() {
cluster := Cluster{} cluster := Cluster{}
cluster.Init(client) cluster.Init(client)
start := time.Now() start := time.Now()
log.Printf("[INFO] starting cluster sync\n")
err := cluster.Sync() err := cluster.Sync()
if err != nil { if err != nil {
log.Printf("[Error] error encountered while syncing cluster: %s", err) log.Printf("[Error] error encountered while syncing cluster: %s", err)
+2
View File
@@ -36,6 +36,7 @@ func (cluster *Cluster) Sync() error {
// get all nodes // get all nodes
nodes, err := cluster.pve.Nodes() nodes, err := cluster.pve.Nodes()
if err != nil { if err != nil {
cluster.lock.Unlock()
return err return err
} }
@@ -56,6 +57,7 @@ func (cluster *Cluster) Sync() error {
err = wg.Wait() err = wg.Wait()
if err != nil { if err != nil {
cluster.lock.Unlock()
return err return err
} }