From ea74dc172a634f4fb5bb3638c9e65581f2bd2b57 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 5 Nov 2021 09:33:44 +0100 Subject: [PATCH] Rename periodic.Stoper to periodic.Stopper --- pkg/icingadb/db.go | 2 +- pkg/icingadb/overdue/sync.go | 2 +- pkg/icingaredis/client.go | 2 +- pkg/periodic/periodic.go | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/icingadb/db.go b/pkg/icingadb/db.go index 98c4d809..bfbf9246 100644 --- a/pkg/icingadb/db.go +++ b/pkg/icingadb/db.go @@ -547,7 +547,7 @@ func (db *DB) GetSemaphoreForTable(table string) *semaphore.Weighted { } } -func (db *DB) log(ctx context.Context, query string, counter *com.Counter) periodic.Stoper { +func (db *DB) log(ctx context.Context, query string, counter *com.Counter) periodic.Stopper { return periodic.Start(ctx, db.logger.Interval(), func(tick periodic.Tick) { if count := counter.Reset(); count > 0 { db.logger.Debugf("Executed %q with %d rows", query, count) diff --git a/pkg/icingadb/overdue/sync.go b/pkg/icingadb/overdue/sync.go index dcd15eb0..0c0a7dbe 100644 --- a/pkg/icingadb/overdue/sync.go +++ b/pkg/icingadb/overdue/sync.go @@ -121,7 +121,7 @@ func (s Sync) initSync(ctx context.Context, objectType string) error { } // log periodically logs sync's workload. -func (s Sync) log(ctx context.Context, objectType string, counter *com.Counter) periodic.Stoper { +func (s Sync) log(ctx context.Context, objectType string, counter *com.Counter) periodic.Stopper { return periodic.Start(ctx, s.logger.Interval(), func(_ periodic.Tick) { if count := counter.Reset(); count > 0 { s.logger.Infof("Synced %d %s overdue indicators", count, objectType) diff --git a/pkg/icingaredis/client.go b/pkg/icingaredis/client.go index fdfb8ea1..3a7922b9 100644 --- a/pkg/icingaredis/client.go +++ b/pkg/icingaredis/client.go @@ -221,7 +221,7 @@ func (c Client) YieldAll(ctx context.Context, subject *common.SyncSubject) (<-ch return desired, com.WaitAsync(g) } -func (c *Client) log(ctx context.Context, key string, counter *com.Counter) periodic.Stoper { +func (c *Client) log(ctx context.Context, key string, counter *com.Counter) periodic.Stopper { return periodic.Start(ctx, c.logger.Interval(), func(tick periodic.Tick) { // We may never get to progress logging here, // as fetching should be completed before the interval expires, diff --git a/pkg/periodic/periodic.go b/pkg/periodic/periodic.go index 0370f0c8..3f19ac86 100644 --- a/pkg/periodic/periodic.go +++ b/pkg/periodic/periodic.go @@ -11,9 +11,9 @@ type Option interface { apply(*periodic) } -// Stoper implements the Stop method, +// Stopper implements the Stop method, // which stops a periodic task from Start(). -type Stoper interface { +type Stopper interface { Stop() // Stops a periodic task. } @@ -36,7 +36,7 @@ func OnStop(f func(Tick)) Option { // which executes the given callback after each tick. // Call Stop() on the return value in order to stop the ticker and to release associated resources. // The interval must be greater than zero. -func Start(ctx context.Context, interval time.Duration, callback func(Tick), options ...Option) Stoper { +func Start(ctx context.Context, interval time.Duration, callback func(Tick), options ...Option) Stopper { t := &periodic{ interval: interval, callback: callback,