MCPcopy Create free account
hub / github.com/cloudbase/garm / runWatcher

Method runWatcher

runner/pool/watcher.go:193–218  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

191}
192
193func (r *basePoolManager) runWatcher() {
194 defer r.consumer.Close()
195 queued, err := r.store.ListEntityJobsByStatus(r.ctx, r.entity.EntityType, r.entity.ID, params.JobStatusQueued)
196 if err != nil {
197 slog.ErrorContext(r.ctx, "failed to list jobs", "error", err)
198 }
199
200 r.mux.Lock()
201 for _, job := range queued {
202 r.jobs[job.ID] = job
203 }
204 r.mux.Unlock()
205 for {
206 select {
207 case <-r.quit:
208 return
209 case <-r.ctx.Done():
210 return
211 case event, ok := <-r.consumer.Watch():
212 if !ok {
213 return
214 }
215 r.handleWatcherEvent(event)
216 }
217 }
218}

Callers 1

StartMethod · 0.95

Calls 7

handleWatcherEventMethod · 0.95
CloseMethod · 0.65
LockMethod · 0.65
UnlockMethod · 0.65
WatchMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected