MCPcopy Create free account
hub / github.com/krau/SaveAny-Bot / StartCleanupLoop

Function StartCleanupLoop

api/progress.go:113–126  ·  view source on GitHub ↗

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{} })

Source from the content-addressed store, hash-verified

111// StartCleanupLoop runs CleanupExpired on a fixed interval until ctx is done.
112// It should be started once during API server initialization.
113func 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.
129func (t *TaskProgressInfo) UpdateStatus(status TaskStatus) {

Callers 1

StartFunction · 0.85

Calls 2

CleanupExpiredFunction · 0.85
DoneMethod · 0.45

Tested by

no test coverage detected