Skip to content

search: more consistently report timeout errors instead of "No results" when `timeout:` directive is present

Administrator requested to merge 3294-indexed-search-timeouts-2 into master

Created by: ijt

This is progress on #3294 .

The fix is in search_results.go, where the call to isContextError(ctx, err) has been replaced with a simpler check ignoring ctx.Err() since it can sometimes happen that the indexed search times out without ctx.Err() becoming non-nil. After this change, code search seems to no longer give the erroneous "No results" message on timeouts, although it is still racy and randomly gives different timeout errors.

This change also includes a helpful hint for a longer timeout directive in the error message.

Test plan: I manually tested it with queries like func timeout:1ms on a sourcegraph instance with a single repo.

Before: Screen Shot 2019-04-12 at 4 55 25 PM

After: Screen Shot 2019-04-12 at 4 42 37 PM

Merge request reports

Loading