Skip to content

Commit

Permalink
Increment currentIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
ferglor committed Apr 22, 2024
1 parent c2e8dbe commit 106be0c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ func (p *logEventProvider) getLogsFromBuffer(latestBlock int64) []ocr2keepers.Up

if p.previousStartWindow == nil {
p.previousStartWindow = &startWindow

} else if p.previousStartWindow != nil && startWindow != *p.previousStartWindow {
p.lggr.Debugw("new block window", "windowStart", startWindow)
p.currentIteration = 0
Expand All @@ -324,14 +323,22 @@ func (p *logEventProvider) getLogsFromBuffer(latestBlock int64) []ocr2keepers.Up

logs, remaining := p.bufferV1.Dequeue(startWindow, end, logLimitLow, maxResults-len(payloads), upkeepSelectorFn)
if len(logs) > 0 {
p.lggr.Debugw("Dequeued logs", "start", start, "latestBlock", latestBlock, "logs", len(logs))
p.lggr.Debugw("Dequeued logs", "start", start, "latestBlock", latestBlock, "logs", len(logs), "iterations", p.iterations, "currentIteration", p.currentIteration)
}
for _, l := range logs {
payload, err := p.createPayload(l.ID, l.Log)
if err == nil {
payloads = append(payloads, payload)
}
}

p.currentIteration++

if p.currentIteration == p.iterations {
start += int64(blockRate)
continue
}

if remaining > 0 {
p.lggr.Debugw("Remaining logs", "start", start, "latestBlock", latestBlock, "remaining", remaining)
// TODO: handle remaining logs in a better way than consuming the entire window, e.g. do not repeat more than x times
Expand Down

0 comments on commit 106be0c

Please sign in to comment.