MCPcopy Create free account
hub / github.com/diillson/chatcli / snapshotLoop

Method snapshotLoop

cli/scheduler/replay.go:197–214  ·  view source on GitHub ↗

snapshotLoop runs periodic writeSnapshot while the scheduler is up.

()

Source from the content-addressed store, hash-verified

195
196// snapshotLoop runs periodic writeSnapshot while the scheduler is up.
197func (s *Scheduler) snapshotLoop() {
198 defer close(s.snapDone)
199 if s.cfg.SnapshotInterval <= 0 {
200 return
201 }
202 t := time.NewTicker(s.cfg.SnapshotInterval)
203 defer t.Stop()
204 for {
205 select {
206 case <-s.ctx.Done():
207 return
208 case <-t.C:
209 if err := s.writeSnapshotNow(); err != nil {
210 s.logger.Warn("scheduler: snapshot failed", zap.Error(err))
211 }
212 }
213 }
214}
215
216// gcLoop reaps terminal jobs past TTL.
217func (s *Scheduler) gcLoop() {

Callers 1

StartMethod · 0.95

Calls 4

writeSnapshotNowMethod · 0.95
WarnMethod · 0.80
StopMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected