debian-mirror-gitlab/lib/gitlab/utils/execution_tracker.rb

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

26 lines
455 B
Ruby
Raw Normal View History

2022-10-11 01:57:18 +05:30
# frozen_string_literal: true
module Gitlab
module Utils
class ExecutionTracker
2022-11-25 23:54:43 +05:30
MAX_RUNTIME = 60.seconds
2022-10-11 01:57:18 +05:30
ExecutionTimeOutError = Class.new(StandardError)
delegate :monotonic_time, to: :'Gitlab::Metrics::System'
def initialize
@start_time = monotonic_time
end
def over_limit?
monotonic_time - start_time >= MAX_RUNTIME
end
private
attr_reader :start_time
end
end
end