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

Method loop

workers/websocket/agent/shell.go:170–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

168}
169
170func (c *ClientSession) loop() {
171 ticker := time.NewTicker(pingPeriod)
172
173 defer func() {
174 c.Stop()
175 ticker.Stop()
176 }()
177
178 for {
179 select {
180 case <-c.done:
181 return
182 case <-c.ctx.Done():
183 return
184 case <-ticker.C:
185 if err := c.safeWrite(websocket.PingMessage, nil); err != nil {
186 if IsErrorOfInterest(err) {
187 slog.With(slog.Any("error", err)).Error("failed to write ping message")
188 }
189 return
190 }
191 }
192 }
193}

Callers 1

StartMethod · 0.95

Calls 6

StopMethod · 0.95
safeWriteMethod · 0.95
IsErrorOfInterestFunction · 0.70
StopMethod · 0.65
DoneMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected