Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw committed Oct 12, 2023
1 parent 728a72e commit aedaf76
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flytestdlib/cache/auto_refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,24 +304,25 @@ func (w *autoRefresh) sync(ctx context.Context) (err error) {
w.workqueue.Forget(batch)
w.workqueue.Done(batch)

t := w.metrics.SyncLatency.Start()
newBatch := make(Batch, 0, len(*batch.(*Batch)))
for _, b := range *batch.(*Batch) {
itemID := b.GetID()
item, ok := w.lruMap.Get(itemID)
if !ok {
logger.Debugf(ctx, "item with id [%v] not found in cache", itemID)
t.Stop()
continue
}
if item.(Item).IsTerminal() {
logger.Debugf(ctx, "item with id [%v] is terminal", itemID)
t.Stop()
continue
}
newBatch = append(newBatch, b)
}
if len(newBatch) == 0 {
continue
}

t := w.metrics.SyncLatency.Start()
updatedBatch, err := w.syncCb(ctx, newBatch)

if err != nil {
Expand Down

0 comments on commit aedaf76

Please sign in to comment.