mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +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.",
|
||||
)
|
||||
}
|
||||
<-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
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user