File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ func (f *follower) Follow(ctx context.Context, lr tessera.LogReader) {
233233 var logSize uint64
234234
235235 // Busy loop while there's work to be done
236- for workDone := true ; workDone ; {
236+ for moreWork := true ; moreWork ; {
237237 err := f .as .db .Update (func (txn * badger.Txn ) error {
238238 ctx , span := tracer .Start (ctx , "tessera.antispam.badger.FollowTxn" )
239239 defer span .End ()
@@ -265,18 +265,19 @@ func (f *follower) Follow(ctx context.Context, lr tessera.LogReader) {
265265 if errors .Is (err , os .ErrNotExist ) {
266266 // The log probably just hasn't completed its first integration yet, so break out of here
267267 // and go back to sleep for a bit to avoid spamming errors into the log and scaring operators.
268- workDone = false
268+ moreWork = false
269269 return nil
270270 }
271271 return fmt .Errorf ("populate: IntegratedSize(): %v" , err )
272272 }
273273 switch {
274274 case followFrom > logSize :
275- workDone = true
275+ // Since we've got a stale view, there could be more work to do - loop and check without sleeping.
276+ moreWork = true
276277 return fmt .Errorf ("followFrom %d > size %d" , followFrom , logSize )
277278 case followFrom == logSize :
278279 // We're caught up, so unblock pushback and go back to sleep
279- workDone = true
280+ moreWork = false
280281 f .as .pushBack .Store (false )
281282 return nil
282283 default :
You can’t perform that action at this time.
0 commit comments