(ctx context.Context)
| 175 | } |
| 176 | |
| 177 | func (w *autoRefresh) enqueueLoop(ctx context.Context) { |
| 178 | timer := w.clock.NewTimer(w.syncPeriod) |
| 179 | defer timer.Stop() |
| 180 | |
| 181 | for { |
| 182 | select { |
| 183 | case <-ctx.Done(): |
| 184 | return |
| 185 | case <-timer.C(): |
| 186 | err := w.enqueueBatches(ctx) |
| 187 | if err != nil { |
| 188 | logger.Errorf(ctx, "Failed to enqueue. Error: %v", err) |
| 189 | } |
| 190 | timer.Reset(w.syncPeriod) |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | // Update updates the item only if it exists in the cache and is not terminal, |
| 196 | // return true if we updated the item. |
no test coverage detected