MCPcopy Index your code
hub / github.com/devspace-sh/devspace / startPing

Method startPing

pkg/devspace/sync/downstream.go:137–156  ·  view source on GitHub ↗
(doneChan chan struct{})

Source from the content-addressed store, hash-verified

135}
136
137func (d *downstream) startPing(doneChan chan struct{}) {
138 go func() {
139 for {
140 select {
141 case <-doneChan:
142 return
143 case <-time.After(time.Second * 15):
144 if d.client != nil {
145 ctx, cancel := context.WithTimeout(d.sync.ctx, time.Second*20)
146 _, err := d.client.Ping(ctx, &remote.Empty{})
147 cancel()
148 if err != nil {
149 d.sync.Stop(fmt.Errorf("ping connection: %v", err))
150 return
151 }
152 }
153 }
154 }
155 }()
156}
157
158func (d *downstream) mainLoop() error {
159 lastAmountChanges := int64(0)

Callers

nothing calls this directly

Calls 4

WithTimeoutMethod · 0.80
PingMethod · 0.65
StopMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected