The core change is moving the context out of the `ServiceRunner` struct to be a local variable, and using a channel to notify about shutdown events. Add more synchronization between Run and the moment service started to avoid mis-identifying not running (yet) service as successfully finished. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> Co-authored-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
19 lines
606 B
Go
19 lines
606 B
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package system
|
|
|
|
import (
|
|
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime"
|
|
"github.com/siderolabs/talos/pkg/conditions"
|
|
)
|
|
|
|
func NewServices(runtime runtime.Runtime) *singleton { //nolint:revive
|
|
return newServices(runtime)
|
|
}
|
|
|
|
func WaitForServiceWithInstance(instance *singleton, event StateEvent, service string) conditions.Condition {
|
|
return waitForService(instance, event, service)
|
|
}
|