Class: Gitlab::Utils::ExecutionTracker
- Inherits:
-
Object
- Object
- Gitlab::Utils::ExecutionTracker
- Defined in:
- lib/gitlab/utils/execution_tracker.rb
Constant Summary collapse
- MAX_RUNTIME =
60.seconds
- ExecutionTimeOutError =
Class.new(StandardError)
Instance Method Summary collapse
-
#initialize(max_runtime = MAX_RUNTIME) ⇒ ExecutionTracker
constructor
A new instance of ExecutionTracker.
- #over_limit? ⇒ Boolean
Constructor Details
#initialize(max_runtime = MAX_RUNTIME) ⇒ ExecutionTracker
Returns a new instance of ExecutionTracker.
12 13 14 15 |
# File 'lib/gitlab/utils/execution_tracker.rb', line 12 def initialize(max_runtime = MAX_RUNTIME) @start_time = monotonic_time @max_runtime = max_runtime end |
Instance Method Details
#over_limit? ⇒ Boolean
17 18 19 |
# File 'lib/gitlab/utils/execution_tracker.rb', line 17 def over_limit? monotonic_time - start_time >= max_runtime end |