From 97c9760b33888972b0488775b62bee6b6a9fa57e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 22 Aug 2024 11:14:01 +0300 Subject: some refactoring --- internal/server/cron/cron.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'internal/server/cron') diff --git a/internal/server/cron/cron.go b/internal/server/cron/cron.go index af9bdad..3de44b8 100644 --- a/internal/server/cron/cron.go +++ b/internal/server/cron/cron.go @@ -21,23 +21,23 @@ func Run(ctx context.Context, conf config.ServerConfig, status health.Status) { case <-ctx.Done(): return case <-helloTicker.C: - run(ctx, "cron.Hello", status, func(ctx context.Context) error { + run(ctx, "cron->Hello", status, func(ctx context.Context) error { log.Println("hello world") return nil }) case <-mergeTicker.C: - run(ctx, "cron.Repository.Merge", status, repository.Instance(conf).MergeRemotely) + run(ctx, "cron->repository.Merge", status, repository.Instance(conf).MergeRemotely) case <-scheduleTicker.C: - run(ctx, "cron.Scheduler.Run", status, scheduler.Run) + run(ctx, "cron->scheduler.Run", status, scheduler.Run) } } } -func run(ctx context.Context, handlerName string, status health.Status, cb func(ctx context.Context) error) { - log.Println("CRON ticker initiating", handlerName) +func run(ctx context.Context, what string, status health.Status, cb func(ctx context.Context) error) { + log.Println("CRON ticker initiating", what) if err := cb(ctx); err != nil { - status.Set(health.Critical, handlerName, err) + status.Set(health.Critical, what, err) return } - status.Clear(handlerName) + status.Clear(what) } -- cgit v1.2.3