fix: update lastSuccessTimestamp after each request too
Updating only in run() can be delayed arbitrarily long under load.
This commit is contained in:
parent
2c6a7201ef
commit
b26866fe0c
1 changed files with 3 additions and 2 deletions
|
@ -201,11 +201,12 @@ func (m *Mirror) runOnce(ctx context.Context) error {
|
||||||
return fmt.Errorf("inserting log entry into database: %w", err)
|
return fmt.Errorf("inserting log entry into database: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !lastTimestamp.IsZero() {
|
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
|
m.lastSuccessTimestamp = time.Now()
|
||||||
|
if !lastTimestamp.IsZero() {
|
||||||
m.lastRecordTimestamp = lastTimestamp
|
m.lastRecordTimestamp = lastTimestamp
|
||||||
m.mu.Unlock()
|
|
||||||
}
|
}
|
||||||
|
m.mu.Unlock()
|
||||||
|
|
||||||
log.Info().Msgf("Got %d log entries. New cursor: %q", len(newEntries), cursor)
|
log.Info().Msgf("Got %d log entries. New cursor: %q", len(newEntries), cursor)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue