diff options
| author | Paul Buetow <paul@buetow.org> | 2024-08-22 11:14:01 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-08-22 11:14:01 +0300 |
| commit | 97c9760b33888972b0488775b62bee6b6a9fa57e (patch) | |
| tree | 9c755b965a95165447321be340cb9d32cc51cb0b /internal/server/cron | |
| parent | a856e039035e14dc50ab6519e2ca9cd2508eb21b (diff) | |
some refactoring
Diffstat (limited to 'internal/server/cron')
| -rw-r--r-- | internal/server/cron/cron.go | 14 |
1 files changed, 7 insertions, 7 deletions
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) } |
