Class: Wurk::Throttle::Outcome
- Inherits:
-
Struct
- Object
- Struct
- Wurk::Throttle::Outcome
- Defined in:
- lib/wurk/throttle.rb
Overview
What one throttled enqueue did to its slot.
jid is whoever owns the slot — the caller when admitted?, the
incumbent when not — and is always set, because a job without one is
refused before the script runs. slot_ends_at is the epoch second it closes,
so it is the earliest this identity can be admitted again; it comes back
from the script because deriving it here would mean re-aligning against
the caller's clock instead of the one the decision was made on.
Instance Attribute Summary collapse
-
#admitted ⇒ Object
Returns the value of attribute admitted.
-
#jid ⇒ Object
Returns the value of attribute jid.
-
#slot_ends_at ⇒ Object
Returns the value of attribute slot_ends_at.
Instance Method Summary collapse
-
#admitted? ⇒ Boolean
True when this push claimed the slot and the caller should enqueue.
-
#dropped? ⇒ Boolean
True when another job already held the slot and this push is dropped.
Instance Attribute Details
#admitted ⇒ Object
Returns the value of attribute admitted
82 83 84 |
# File 'lib/wurk/throttle.rb', line 82 def admitted @admitted end |
#jid ⇒ Object
Returns the value of attribute jid
82 83 84 |
# File 'lib/wurk/throttle.rb', line 82 def jid @jid end |
#slot_ends_at ⇒ Object
Returns the value of attribute slot_ends_at
82 83 84 |
# File 'lib/wurk/throttle.rb', line 82 def slot_ends_at @slot_ends_at end |
Instance Method Details
#admitted? ⇒ Boolean
True when this push claimed the slot and the caller should enqueue.
84 |
# File 'lib/wurk/throttle.rb', line 84 def admitted? = admitted |
#dropped? ⇒ Boolean
True when another job already held the slot and this push is dropped.
87 |
# File 'lib/wurk/throttle.rb', line 87 def dropped? = !admitted |