Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-16 00:10:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-16 00:10:04 +0300
commitec3e75cfeadc943e3fc63ac5e6b5504ad43ea512 (patch)
tree79bc910fc137d5c46d6670a98e74a0438486f0bf /lib/gitlab/render_timeout.rb
parent36b47b4bd3eb88b08323cb26f5863e1dacdb18b7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/render_timeout.rb')
-rw-r--r--lib/gitlab/render_timeout.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab/render_timeout.rb b/lib/gitlab/render_timeout.rb
new file mode 100644
index 00000000000..b3c2a5b4c2a
--- /dev/null
+++ b/lib/gitlab/render_timeout.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module RenderTimeout
+ BACKGROUND = 30.seconds
+ FOREGROUND = 1.5.seconds
+
+ def self.timeout(background: BACKGROUND, foreground: FOREGROUND, &block)
+ period = Gitlab::Runtime.sidekiq? ? background : foreground
+
+ Timeout.timeout(period, &block)
+ end
+ end
+end