fix: graceful machine shutdown when not initialised

This commit is contained in:
Pasha Sviderski
2025-07-25 10:50:23 +10:00
parent 7a6c5bf6d7
commit 3ab708a437
+6 -1
View File
@@ -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.",
)
}
<-m.initialised
select {
case <-m.initialised:
m.cluster.UpdateMachineID(m.state.ID)
// 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.")
case <-ctx.Done():
// The context was cancelled before the machine was initialised.
}
return nil
})