From 12a4efb7151d1997b3edb9236e2e209eceeba32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Samin?= Date: Fri, 18 Jun 2021 15:51:39 +0200 Subject: [PATCH] fix(api,cdn): restart some goroutines (#5852) --- engine/api/api.go | 2 +- engine/api/status.go | 2 +- engine/cdn/cdn_metrics.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/api/api.go b/engine/api/api.go index 5fc5b822f7..fd44e1c1fa 100644 --- a/engine/api/api.go +++ b/engine/api/api.go @@ -801,7 +801,7 @@ func (a *API) Serve(ctx context.Context) error { func(ctx context.Context) { services.Pings(ctx, a.mustDB, externalServices) }) - a.GoRoutines.Run(ctx, "workflow.Initialize", + a.GoRoutines.RunWithRestart(ctx, "workflow.Initialize", func(ctx context.Context) { workflow.SetMaxRuns(a.Config.Workflow.MaxRuns) workflow.Initialize(ctx, a.DBConnectionFactory.GetDBMap(gorpmapping.Mapper), a.Cache, a.Config.URL.UI, a.Config.DefaultOS, a.Config.DefaultArch, a.Config.Log.StepMaxSize) diff --git a/engine/api/status.go b/engine/api/status.go index 61196e9ae0..f58ce0f79a 100644 --- a/engine/api/status.go +++ b/engine/api/status.go @@ -279,7 +279,7 @@ func (api *API) computeMetrics(ctx context.Context) { log.Error(ctx, "api.computeMetrics> unable to tag observability context: %v", err) } - api.GoRoutines.Run(ctx, "api.computeMetrics", func(ctx context.Context) { + api.GoRoutines.RunWithRestart(ctx, "api.computeMetrics", func(ctx context.Context) { tick := time.NewTicker(9 * time.Second).C for { select { diff --git a/engine/cdn/cdn_metrics.go b/engine/cdn/cdn_metrics.go index 0dd1240d8a..c2af8cb5ea 100644 --- a/engine/cdn/cdn_metrics.go +++ b/engine/cdn/cdn_metrics.go @@ -65,7 +65,7 @@ func (s *Service) initMetrics(ctx context.Context) error { itemUnitToDeleteView := telemetry.NewViewLast(s.Metrics.ItemUnitToDelete.Name(), s.Metrics.ItemUnitToDelete, []tag.Key{tagStorage, tagItemType}) if s.DBConnectionFactory != nil { - s.GoRoutines.Run(ctx, "cds-compute-metrics", func(ctx context.Context) { + s.GoRoutines.RunWithRestart(ctx, "cds-compute-metrics", func(ctx context.Context) { s.ComputeMetrics(ctx) }) }