mirror of
https://github.com/grafana/grafana.git
synced 2026-08-14 07:04:57 -05:00
Chore: Add AwaitHealthy to ModuleEngine and Server (#72215)
* Chore: Add AwaitHealthy to ModuleEngine and Server * switch from fmt.Errorf to errors.New Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> --------- Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
co-authored by
Will Browne
parent
c7eb7fb58a
commit
4b95f611c2
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
type Engine interface {
|
||||
AwaitHealthy(context.Context) error
|
||||
Init(context.Context) error
|
||||
Run(context.Context) error
|
||||
Shutdown(context.Context) error
|
||||
@@ -59,6 +60,14 @@ func ProvideService(
|
||||
}
|
||||
}
|
||||
|
||||
// AwaitHealthy waits for all registered modules to be healthy.
|
||||
func (m *service) AwaitHealthy(ctx context.Context) error {
|
||||
if m.serviceManager == nil {
|
||||
return errors.New("service manager has not been initialized")
|
||||
}
|
||||
return m.serviceManager.AwaitHealthy(ctx)
|
||||
}
|
||||
|
||||
// Init initializes all registered modules.
|
||||
func (m *service) Init(_ context.Context) error {
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user