MCPcopy
hub / github.com/sourcegraph/checkup / doChecks

Method doChecks

check/http/http.go:125–145  ·  view source on GitHub ↗

doChecks executes req using c.Client and returns each attempt.

(req *http.Request)

Source from the content-addressed store, hash-verified

123
124// doChecks executes req using c.Client and returns each attempt.
125func (c Checker) doChecks(req *http.Request) types.Attempts {
126 checks := make(types.Attempts, c.Attempts)
127 for i := 0; i < c.Attempts; i++ {
128 start := time.Now()
129 resp, err := c.Client.Do(req)
130 checks[i].RTT = time.Since(start)
131 if err != nil {
132 checks[i].Error = err.Error()
133 continue
134 }
135 err = c.checkDown(resp)
136 if err != nil {
137 checks[i].Error = err.Error()
138 }
139 resp.Body.Close()
140 if c.AttemptSpacing > 0 {
141 time.Sleep(c.AttemptSpacing)
142 }
143 }
144 return checks
145}
146
147// conclude takes the data in result from the attempts and
148// computes remaining values needed to fill out the result.

Callers 1

CheckMethod · 0.95

Implementers 6

fakecheckup_test.go
Checkercheck/http/http.go
Checkercheck/dns/dns.go
Checkercheck/exec/exec.go
Checkercheck/tls/tls.go
Checkercheck/tcp/tcp.go

Calls 2

checkDownMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected