aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/monitor/tail.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/monitor/tail.go b/internal/monitor/tail.go
index 43a6d56..2603e81 100644
--- a/internal/monitor/tail.go
+++ b/internal/monitor/tail.go
@@ -76,13 +76,17 @@ func (t *tail) run(ctx context.Context, mon MonitoredLog, eventCh chan Event, er
}
func (t *tail) sequence(ctx context.Context, mon MonitoredLog, eventCh chan Event, errorCh chan error, chunkCh chan *chunk) {
+ var failedAt time.Time
state := mon.State
heap := newChunks()
sendChunk := func(ctx context.Context, force bool) {
+ if !failedAt.IsZero() && failedAt.Add(30*time.Second).After(time.Now()) {
+ return // ensures we don't spam get-sth and proof endpoints
+ }
+
if heap.gap(state.NextIndex) {
return // nothing to send yet
}
-
c := heap.pop()
if !force && len(c.matches) == 0 && len(c.leafHashes) < int(t.cfg.ChunkSize) {
heap.push(c)
@@ -91,6 +95,7 @@ func (t *tail) sequence(ctx context.Context, mon MonitoredLog, eventCh chan Even
nextState, err := t.nextState(ctx, state, c)
if err != nil {
+ failedAt = time.Now()
errorCh <- err
heap.push(c)
return