Implement catalog startup diagnostics (T-616)
This commit is contained in:
@@ -35,6 +35,10 @@ func main() {
|
||||
}
|
||||
|
||||
func run() error {
|
||||
return runWithCatalogLoader(application.UnconfiguredCatalogLoader{})
|
||||
}
|
||||
|
||||
func runWithCatalogLoader(loader application.CatalogSnapshotLoader) error {
|
||||
platform := windows.New()
|
||||
window := new(app.Window)
|
||||
window.Option(
|
||||
@@ -59,10 +63,18 @@ func run() error {
|
||||
window.Invalidate,
|
||||
)
|
||||
}()
|
||||
catalogDone := startCatalogBootstrap(eventContext, runtime, loader)
|
||||
defer func() {
|
||||
cancelEvents()
|
||||
runtime.Close()
|
||||
relay.Close()
|
||||
if bootstrapErr := <-catalogDone; bootstrapErr != nil &&
|
||||
!errors.Is(bootstrapErr, context.Canceled) &&
|
||||
!errors.Is(bootstrapErr, application.ErrCatalogSourceUnconfigured) &&
|
||||
!errors.Is(bootstrapErr, application.ErrRuntimeClosed) &&
|
||||
!errors.Is(bootstrapErr, application.ErrEventRelayClosed) {
|
||||
log.Printf("%s catalog bootstrap failed", core.ProductName)
|
||||
}
|
||||
if pumpErr := <-pumpDone; pumpErr != nil &&
|
||||
!errors.Is(pumpErr, context.Canceled) &&
|
||||
!errors.Is(pumpErr, application.ErrEventRelayClosed) {
|
||||
@@ -85,3 +97,15 @@ func run() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func startCatalogBootstrap(
|
||||
ctx context.Context,
|
||||
runtime *application.Runtime,
|
||||
loader application.CatalogSnapshotLoader,
|
||||
) <-chan error {
|
||||
done := make(chan error, 1)
|
||||
go func() {
|
||||
done <- application.NewCatalogBootstrap(loader, runtime).Run(ctx)
|
||||
}()
|
||||
return done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user