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

Function CheckTimeout

db/database.go:2149–2159  ·  view source on GitHub ↗

Returns an HTTP timeout (408) error if the Database's Context has an expired timeout or has been explicitly canceled. (See WithTimeout.)

(ctx context.Context)

Source from the content-addressed store, hash-verified

2147
2148// Returns an HTTP timeout (408) error if the Database's Context has an expired timeout or has been explicitly canceled. (See WithTimeout.)
2149func CheckTimeout(ctx context.Context) error {
2150 if ctx == nil {
2151 return nil
2152 }
2153 select {
2154 case <-ctx.Done():
2155 return base.HTTPErrorf(http.StatusRequestTimeout, "Request timed out")
2156 default:
2157 return nil
2158 }
2159}
2160
2161// / LOGGING
2162

Callers 6

writeQueryRowsMethod · 0.92
InvokeMethod · 0.92
IterateMethod · 0.92
do_getMethod · 0.92
do_saveMethod · 0.92
handleFunctionMethod · 0.85

Calls 2

HTTPErrorfFunction · 0.92
DoneMethod · 0.80

Tested by

no test coverage detected