Skip to content

Commit

Permalink
Increase scanner size to 1MB for large JSON objects
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche committed Mar 21, 2024
1 parent 8f7191b commit c82ffc2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func SearchGraph(apiEndpoint, fixToken, workspaceID, searchStr string, withEdges
}

scanner := bufio.NewScanner(resp.Body)
const maxTokenSize = 1024 * 1024
buf := make([]byte, maxTokenSize)
scanner.Buffer(buf, maxTokenSize)

for scanner.Scan() {
var result interface{}
if err := json.Unmarshal(scanner.Bytes(), &result); err != nil {
Expand Down

0 comments on commit c82ffc2

Please sign in to comment.