fix: update lastSuccessTimestamp after each request too
Updating only in run() can be delayed arbitrarily long under load.main^2
parent
2c6a7201ef
commit
b26866fe0c
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.mu.Lock()
|
||||||
|
m.lastSuccessTimestamp = time.Now()
|
||||||
if !lastTimestamp.IsZero() {
|
if !lastTimestamp.IsZero() {
|
||||||
m.mu.Lock()
|
|
||||||
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…
Reference in New Issue