StartCleanupLoop runs CleanupExpired on a fixed interval until ctx is done. It should be started once during API server initialization.
(ctx interface{ Done() <-chan struct{} })
| 111 | // StartCleanupLoop runs CleanupExpired on a fixed interval until ctx is done. |
| 112 | // It should be started once during API server initialization. |
| 113 | func StartCleanupLoop(ctx interface{ Done() <-chan struct{} }) { |
| 114 | go func() { |
| 115 | ticker := time.NewTicker(10 * time.Minute) |
| 116 | defer ticker.Stop() |
| 117 | for { |
| 118 | select { |
| 119 | case <-ctx.Done(): |
| 120 | return |
| 121 | case <-ticker.C: |
| 122 | CleanupExpired() |
| 123 | } |
| 124 | } |
| 125 | }() |
| 126 | } |
| 127 | |
| 128 | // UpdateStatus sets the task status. |
| 129 | func (t *TaskProgressInfo) UpdateStatus(status TaskStatus) { |
no test coverage detected