diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 00:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 00:10:04 +0300 |
commit | ec3e75cfeadc943e3fc63ac5e6b5504ad43ea512 (patch) | |
tree | 79bc910fc137d5c46d6670a98e74a0438486f0bf /lib/gitlab/highlight.rb | |
parent | 36b47b4bd3eb88b08323cb26f5863e1dacdb18b7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/highlight.rb')
-rw-r--r-- | lib/gitlab/highlight.rb | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb index 758a594036b..b71abe5c052 100644 --- a/lib/gitlab/highlight.rb +++ b/lib/gitlab/highlight.rb @@ -2,9 +2,6 @@ module Gitlab class Highlight - TIMEOUT_BACKGROUND = 30.seconds - TIMEOUT_FOREGROUND = 1.5.seconds - def self.highlight(blob_name, blob_content, language: nil, plain: false) new(blob_name, blob_content, language: language) .highlight(blob_content, continue: false, plain: plain) @@ -72,7 +69,7 @@ module Gitlab def highlight_rich(text, continue: true) tag = lexer.tag tokens = lexer.lex(text, continue: continue) - Timeout.timeout(timeout_time) { @formatter.format(tokens, **context, tag: tag).html_safe } + Gitlab::RenderTimeout.timeout { @formatter.format(tokens, **context, tag: tag).html_safe } rescue Timeout::Error => e Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e) highlight_plain(text) @@ -80,10 +77,6 @@ module Gitlab highlight_plain(text) end - def timeout_time - Gitlab::Runtime.sidekiq? ? TIMEOUT_BACKGROUND : TIMEOUT_FOREGROUND - end - def link_dependencies(text, highlighted_text) Gitlab::DependencyLinker.link(blob_name, text, highlighted_text) end |