Commit 40209866 authored by Patrick Bajao's avatar Patrick Bajao

Make highlighting limits stricter

Currently, whenever we highlight text via `Gitlab::Highlight` as
rich text, it takes a long time (~3s). It falls back to plain text
highlighting after 3 seoncds due to the limit set via
`TIMEOUT_FOREGROUND`.

We are reducing that to 1.5 seconds so we don't have to wait that
long before falling back to plain highlighting.

We are also reducing `MAXIMUM_TEXT_HIGHLIGHT_SIZE` to 512 KB so
we don't need to wait 1.5 seconds before falling back as well when
highlighting a huge file.
parent 9edcaac8
---
title: Make highlighting limits stricter
merge_request: 39934
author:
type: performance
......@@ -3,8 +3,8 @@
module Gitlab
class Highlight
TIMEOUT_BACKGROUND = 30.seconds
TIMEOUT_FOREGROUND = 3.seconds
MAXIMUM_TEXT_HIGHLIGHT_SIZE = 1.megabyte
TIMEOUT_FOREGROUND = 1.5.seconds
MAXIMUM_TEXT_HIGHLIGHT_SIZE = 512.kilobytes
def self.highlight(blob_name, blob_content, language: nil, plain: false)
new(blob_name, blob_content, language: language)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment