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

Method sleepWithCancel

workers/cache/tool_cache.go:149–163  ·  view source on GitHub ↗
(sleepTime time.Duration)

Source from the content-addressed store, hash-verified

147}
148
149func (t *toolsUpdater) sleepWithCancel(sleepTime time.Duration) (canceled bool) {
150 if sleepTime == 0 {
151 return false
152 }
153 ticker := time.NewTicker(sleepTime)
154 defer ticker.Stop()
155
156 select {
157 case <-ticker.C:
158 return false
159 case <-t.quit:
160 case <-t.ctx.Done():
161 }
162 return true
163}
164
165// giteaUpdateLoop updates tools for gitea. The act runner can be downloaded
166// without a token, unlike the github tools, which for GHES require a token.

Callers 1

loopMethod · 0.95

Calls 2

StopMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected