Skip to content

search: only give timeout alert if we had no results

Warren Gifford requested to merge master-dry-run/k/timeout-alert into main

Created by: keegancsmith

This PR removes the need for resultsWithTimeoutSuggestion to exist. resultsWithTimeoutSuggestion was added so other code could call doResults and get back a context.DeadlineExceeded if we timedout. However, the code has evolved a lot since then. Currently the only way doResults returns DeadlineExceeded is if determineRepos times out (rare). This commit makes it such that doResults never returns DeadlineExceeded and consistently sets the timeout alert iff we had no results and all repos timed out.

To do this we made determineRepos check for a timeout. Additionally we had to track the start time for the alert. This is now done in a more correct place, SearchInputs.

This was tested by doing lots of manual testing. In particular around AND queries as well as searching across lots of unindexed branches.

Fixes https://github.com/sourcegraph/sourcegraph/issues/20319

Merge request reports

Loading