debian-mirror-gitlab/lib/gitlab/utils/execution_tracker.rb
2022-11-25 23:54:43 +05:30

25 lines
455 B
Ruby

# frozen_string_literal: true
module Gitlab
module Utils
class ExecutionTracker
MAX_RUNTIME = 60.seconds
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