Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
search: fix regression where search result highlighting is not bailed…
Browse files Browse the repository at this point in the history
… out after 3s

Prior to this change there was a major regression in which we would disable the
syntax highlighting timeout outright. This is despite the fact that this should
only ever be done when the user has communicated an intent to wait longer for
search results.

This regression meant that when a search turned up files that the syntax highlighter could
not highlight quickly, we would just wait for them until it finished. In one customer
environment I observed search results taking 30s+ to load due to this because it had the
added negative consequence of us not canceling those poorly performing requests which led to
syntect_server trying to perform tons of CPU-intensive requests which harmed other requests
it was handling.

After this change, we are properly bailing out once again after the syntax highlighting
timeout.

This means that in this bad case you are waiting 3s then getting plaintext results instead of
waiting 30s+ for highlighting.

Fixes #4268

Test plan: Manually tested using #4364, in the future we will e2e test it.
  • Loading branch information
slimsag committed Jun 5, 2019
1 parent 19cef16 commit 0edd730
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion shared/src/components/CodeExcerpt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class CodeExcerpt extends React.PureComponent<Props, State> {
commitID,
filePath,
isLightTheme,
disableTimeout: true,
disableTimeout: false,
})
),
catchError(error => [asError(error)])
Expand Down
3 changes: 0 additions & 3 deletions web/src/repo/backend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ export const fetchHighlightedFileLines = memoizeObservable(
if (result.isDirectory) {
return []
}
if (result.highlightedFile.aborted) {
throw new Error('aborted fetching highlighted contents')
}
let parsed = result.highlightedFile.html.substr('<table>'.length)
parsed = parsed.substr(0, parsed.length - '</table>'.length)
const rows = parsed.split('</tr>')
Expand Down

0 comments on commit 0edd730

Please sign in to comment.