mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 12:03:33 +00:00
fix: graceful machine shutdown when not initialised
This commit is contained in:
@@ -361,8 +361,9 @@ func (m *Machine) Run(ctx context.Context) error {
|
|||||||
"Waiting for the machine to be initialised as a member of a cluster to start the cluster controller.",
|
"Waiting for the machine to be initialised as a member of a cluster to start the cluster controller.",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<-m.initialised
|
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-m.initialised:
|
||||||
m.cluster.UpdateMachineID(m.state.ID)
|
m.cluster.UpdateMachineID(m.state.ID)
|
||||||
|
|
||||||
// Ensure the corrosion config is up to date, including a new gossip address if the machine
|
// Ensure the corrosion config is up to date, including a new gossip address if the machine
|
||||||
@@ -418,6 +419,10 @@ func (m *Machine) Run(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
slog.Info("Cluster controller stopped.")
|
slog.Info("Cluster controller stopped.")
|
||||||
|
|
||||||
|
case <-ctx.Done():
|
||||||
|
// The context was cancelled before the machine was initialised.
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user