Files
gitlab-foss/lib/gitlab/render_timeout.rb
2024-07-01 12:14:52 +00:00

19 lines
451 B
Ruby

# 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
def self.banzai_timeout_disabled?
Gitlab::Utils.to_boolean(ENV['DISABLE_BANZAI_TIMEOUT'], default: false)
end
end
end