Skip to content

compute streaming api close channel on query parsing errors

Administrator requested to merge cw/compute-stream-hang into main

Created by: chwarwick

In the streaming endpoint when the parsing of the query errored a nil channel was returned which was blocking and caused the endpoint to hang.

closes https://github.com/sourcegraph/sourcegraph/issues/39835

Test plan

Without a pattern

GET 'https://sourcegraph.test:3443/.api/compute/stream?q=select:file count:all patternType:literal repo:^github.com/sourcegraph/sourcegraph$' 
HTTP/2 500
compute endpoint expects nonempty pattern

With a pattern

GET 'https://sourcegraph.test:3443/.api/compute/stream' --data-urlencode 'q=select:file count:all patternType:literal repo:^github.com/sourcegraph/sourcegraph$ hasapattern' 
event: progress
data: {"done":true,"matchCount":0,"durationMs":9,"skipped":[]}

event: done
data: {}

Merge request reports

Loading