debian-mirror-gitlab/lib/gitlab/render_timeout.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
326 B
Ruby
Raw Permalink Normal View History

2022-07-23 23:45:48 +05:30
# 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