cleanup deletes all expired tasks.
()
| 274 | |
| 275 | // cleanup deletes all expired tasks. |
| 276 | func (t *tasks) cleanup() { |
| 277 | const taskTtl = 7 * 24 * time.Hour // 1 week |
| 278 | minTs := time.Now().UTC().Add(-taskTtl).Unix() |
| 279 | minMeta := uint64(minTs) << 32 |
| 280 | |
| 281 | t.logMu.Lock() |
| 282 | defer t.logMu.Unlock() |
| 283 | t.log.DeleteBelow(minMeta) |
| 284 | } |
| 285 | |
| 286 | // newId generates a random unique task ID. logMu must be acquired before calling this function. |
| 287 | // |