Class: LittleGhost::Artifacts::WorkspaceStore::ContextControl
- Inherits:
-
Data
- Object
- Data
- LittleGhost::Artifacts::WorkspaceStore::ContextControl
- Defined in:
- lib/little_ghost/artifacts/workspace_store.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#cancellation_tokens ⇒ Object
readonly
Returns the value of attribute cancellation_tokens.
-
#deadlines ⇒ Object
readonly
Returns the value of attribute deadlines.
Instance Method Summary collapse
Instance Attribute Details
#cancellation_tokens ⇒ Object (readonly)
Returns the value of attribute cancellation_tokens
14 15 16 |
# File 'lib/little_ghost/artifacts/workspace_store.rb', line 14 def cancellation_tokens @cancellation_tokens end |
#deadlines ⇒ Object (readonly)
Returns the value of attribute deadlines
14 15 16 |
# File 'lib/little_ghost/artifacts/workspace_store.rb', line 14 def deadlines @deadlines end |
Instance Method Details
#check! ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/little_ghost/artifacts/workspace_store.rb', line 15 def check! cancelled = cancellation_tokens.any? do |token| Support::CancellationToken.instance_method(:cancelled?).bind_call(token) end raise CancelledError, "The run was cancelled" if cancelled if deadlines.any? { |deadline| Time.now.to_f >= deadline } raise DeadlineExceededError, "The run deadline was reached" end end |