Skip to content

Commit

Permalink
fix(api,cdn): restart some goroutines (#5852)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsamin authored Jun 18, 2021
1 parent 09c1cf0 commit 12a4efb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion engine/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion engine/api/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion engine/cdn/cdn_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand Down

0 comments on commit 12a4efb

Please sign in to comment.