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)
| 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 |
| 43 | func 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 |
| 61 | func putDDocForTombstones(ctx context.Context, name string, payload []byte, capiEps []string, client *http.Client, username string, password string) error { |
no test coverage detected