mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
poller: clear errors after logging
This commit is contained in:
parent
afcd37dac6
commit
6bf4846ae8
1 changed files with 5 additions and 0 deletions
|
@ -94,6 +94,10 @@ func (p *Poller[T, AggregateT]) gatherErrs() (string, bool) {
|
||||||
return strings.Join(errs, "\n"), true
|
return strings.Join(errs, "\n"), true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Poller[T, AggregateT]) clearErrs() {
|
||||||
|
p.errs = p.errs[:0]
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Poller[T, AggregateT]) pollWithTimeout(ctx context.Context) {
|
func (p *Poller[T, AggregateT]) pollWithTimeout(ctx context.Context) {
|
||||||
ctx, cancel := context.WithTimeout(ctx, p.interval())
|
ctx, cancel := context.WithTimeout(ctx, p.interval())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
@ -129,6 +133,7 @@ func (p *Poller[T, AggregateT]) Start() {
|
||||||
if ok {
|
if ok {
|
||||||
logging.Error().Msg(errs)
|
logging.Error().Msg(errs)
|
||||||
}
|
}
|
||||||
|
p.clearErrs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Add table
Reference in a new issue