MCPcopy Create free account
hub / github.com/github/gh-aw / waitForCompileUpdateNotification

Function waitForCompileUpdateNotification

pkg/cli/compile_update_check.go:132–163  ·  view source on GitHub ↗
(ctx context.Context, results <-chan *compileUpdateNotification, timeout time.Duration)

Source from the content-addressed store, hash-verified

130}
131
132func waitForCompileUpdateNotification(ctx context.Context, results <-chan *compileUpdateNotification, timeout time.Duration) *compileUpdateNotification {
133 if results == nil {
134 return nil
135 }
136
137 if timeout <= 0 {
138 select {
139 case result, ok := <-results:
140 if !ok {
141 return nil
142 }
143 return result
144 default:
145 return nil
146 }
147 }
148
149 timer := time.NewTimer(timeout)
150 defer timer.Stop()
151
152 select {
153 case result, ok := <-results:
154 if !ok {
155 return nil
156 }
157 return result
158 case <-timer.C:
159 return nil
160 case <-ctx.Done():
161 return nil
162 }
163}
164
165func runCompileUpdateCheck(ctx context.Context, client *http.Client) (*compileUpdateNotification, error) {
166 currentVersion := GetVersion()

Callers 1

StartCompileUpdateCheckFunction · 0.85

Calls 2

DoneMethod · 0.80
StopMethod · 0.45

Tested by

no test coverage detected