mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Rename periodic.Stoper to periodic.Stopper
This commit is contained in:
parent
886c60c95a
commit
ea74dc172a
4 changed files with 6 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue