retentionLoop watches a timer to clean up blocks that are past retention. todo: correctly pass context all the way to the backend so a cancelled context can stop the retention loop. see implementation of compactionLoop()
(ctx context.Context)
| 15 | // todo: correctly pass context all the way to the backend so a cancelled context can stop the retention loop. |
| 16 | // see implementation of compactionLoop() |
| 17 | func (rw *readerWriter) retentionLoop(ctx context.Context) { |
| 18 | ticker := time.NewTicker(rw.cfg.BlocklistPoll) |
| 19 | for { |
| 20 | select { |
| 21 | case <-ctx.Done(): |
| 22 | return |
| 23 | default: |
| 24 | } |
| 25 | |
| 26 | select { |
| 27 | case <-ticker.C: |
| 28 | rw.doRetention(ctx) |
| 29 | case <-ctx.Done(): |
| 30 | return |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func (rw *readerWriter) doRetention(ctx context.Context) { |
| 36 | rw.RetainWithConfig(ctx, rw.compactorCfg, rw.compactorSharder, rw.compactorOverrides) |
no test coverage detected