From a59f1dd361ae91c736ca6eac11216b87d0f01608 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Thu, 28 Jul 2022 19:41:11 +0200 Subject: [PATCH] Remove wrapping function from scheduler's watch() --- pkg/scheduler/service.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/scheduler/service.go b/pkg/scheduler/service.go index 9bf55d3cd..a4da9d639 100644 --- a/pkg/scheduler/service.go +++ b/pkg/scheduler/service.go @@ -140,16 +140,14 @@ func (svc *service) watch(ctx context.Context) { svc.dispatch(ctx) for { - func() { - select { - case <-svc.ticker().C: - svc.dispatch(ctx) + select { + case <-svc.ticker().C: + svc.dispatch(ctx) - case <-ctx.Done(): - svc.log.Debug("done") - return - } - }() + case <-ctx.Done(): + svc.log.Debug("done") + return + } } }