MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / runWithRetriesForResp

Function runWithRetriesForResp

dgraph/cmd/alpha/http_test.go:313–336  ·  view source on GitHub ↗
(method, contentType, url string, body string)

Source from the content-addressed store, hash-verified

311}
312
313func runWithRetriesForResp(method, contentType, url string, body string) (
314 *x.QueryResWithData, []byte, *http.Response, error) {
315
316 req, err := createRequest(method, contentType, url, body)
317 if err != nil {
318 return nil, nil, nil, err
319 }
320
321 qr, respBody, resp, err := runRequest(req)
322 if err != nil && strings.Contains(err.Error(), "Token is expired") {
323 if err := token.refreshToken(); err != nil {
324 return nil, nil, nil, err
325 }
326
327 // create a new request since the previous request would have been closed upon the err
328 retryReq, err := createRequest(method, contentType, url, body)
329 if err != nil {
330 return nil, nil, resp, err
331 }
332
333 return runRequest(retryReq)
334 }
335 return qr, respBody, resp, err
336}
337
338func commitWithTs(mr mutationResponse, abort bool) error {
339 url := addr + "/commit"

Callers 3

queryWithTsForRespFunction · 0.85
mutationWithTsFunction · 0.85
runWithRetriesFunction · 0.85

Calls 4

createRequestFunction · 0.85
runRequestFunction · 0.85
refreshTokenMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…