MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / isGoCBQueryTimeoutError

Function isGoCBQueryTimeoutError

base/bucket_gocb.go:43–58  ·  view source on GitHub ↗

If the error is a net/url.Error and the error message is: net/http: request canceled while waiting for connection Then it means that the view request timed out, most likely due to the fact that it's a stale=false query and it's rebuilding the index. In that case, it's desirable to return a more

(err error)

Source from the content-addressed store, hash-verified

41// it's rebuilding the index. In that case, it's desirable to return a more informative error than the
42// underlying net/url.Error. See https://github.com/couchbase/sync_gateway/issues/2639
43func isGoCBQueryTimeoutError(err error) bool {
44
45 if err == nil {
46 return false
47 }
48
49 // If it's not a *url.Error, then it's not a viewtimeout error
50 netUrlError, ok := pkgerrors.Cause(err).(*url.Error)
51 if !ok {
52 return false
53 }
54
55 // If it's a *url.Error and contains the "request canceled" substring, then it's a viewtimeout error.
56 return strings.Contains(netUrlError.Error(), "request canceled")
57
58}
59
60// putDDocForTombstones uses the provided client and endpoints to create a design doc with index_xattr_on_deleted_docs=true
61func putDDocForTombstones(ctx context.Context, name string, payload []byte, capiEps []string, client *http.Client, username string, password string) error {

Callers 1

executeViewQueryMethod · 0.85

Calls 2

ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected