(ctx context.Context)
| 73 | ) |
| 74 | |
| 75 | func (rw *readerWriter) compactionLoop(ctx context.Context) { |
| 76 | compactionCycle := DefaultCompactionCycle |
| 77 | if rw.compactorCfg.CompactionCycle > 0 { |
| 78 | compactionCycle = rw.compactorCfg.CompactionCycle |
| 79 | } |
| 80 | |
| 81 | // Keep going until the context is cancelled, which means we're shutting down and need to stop compacting |
| 82 | for ctx.Err() == nil { |
| 83 | doForAtLeast(ctx, compactionCycle, func() { |
| 84 | rw.compactOneTenant(ctx) |
| 85 | }) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // compactOneTenant runs a compaction cycle every 30s |
| 90 | func (rw *readerWriter) compactOneTenant(ctx context.Context) { |
no test coverage detected