Class: Wurk::Throttle::Outcome

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#admittedObject

Returns the value of attribute admitted

Returns:

  • (Object)

    the current value of admitted



82
83
84
# File 'lib/wurk/throttle.rb', line 82

def admitted
  @admitted
end

#jidObject

Returns the value of attribute jid

Returns:

  • (Object)

    the current value of jid



82
83
84
# File 'lib/wurk/throttle.rb', line 82

def jid
  @jid
end

#slot_ends_atObject

Returns the value of attribute slot_ends_at

Returns:

  • (Object)

    the current value of 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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


87
# File 'lib/wurk/throttle.rb', line 87

def dropped? = !admitted