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

render_timeout.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3c2a5b4c2ad11fc299c01a5eeada9fd865e7ffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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