Class: Flightdeck::QueueStats::Row

Inherits:
Struct
  • Object
show all
Defined in:
app/models/flightdeck/queue_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#completed_in_windowObject

Returns the value of attribute completed_in_window

Returns:

  • (Object)

    the current value of completed_in_window



13
14
15
# File 'app/models/flightdeck/queue_stats.rb', line 13

def completed_in_window
  @completed_in_window
end

#depthObject

Returns the value of attribute depth

Returns:

  • (Object)

    the current value of depth



13
14
15
# File 'app/models/flightdeck/queue_stats.rb', line 13

def depth
  @depth
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



13
14
15
# File 'app/models/flightdeck/queue_stats.rb', line 13

def name
  @name
end

#oldest_ready_atObject

Returns the value of attribute oldest_ready_at

Returns:

  • (Object)

    the current value of oldest_ready_at



13
14
15
# File 'app/models/flightdeck/queue_stats.rb', line 13

def oldest_ready_at
  @oldest_ready_at
end

#paused_atObject

Returns the value of attribute paused_at

Returns:

  • (Object)

    the current value of paused_at



13
14
15
# File 'app/models/flightdeck/queue_stats.rb', line 13

def paused_at
  @paused_at
end

Instance Method Details

#idle?Boolean

Returns:

  • (Boolean)


31
# File 'app/models/flightdeck/queue_stats.rb', line 31

def idle? = depth.zero? && completed_in_window.zero?

#latencyObject

Latency only means something when something is actually waiting: an empty queue has no oldest job, and reporting "0s" would imply we measured rather than that there was nothing to measure.



20
21
22
23
24
# File 'app/models/flightdeck/queue_stats.rb', line 20

def latency
  return nil if depth.zero? || oldest_ready_at.nil?

  Time.current - oldest_ready_at
end

#paused?Boolean

Returns:

  • (Boolean)


15
# File 'app/models/flightdeck/queue_stats.rb', line 15

def paused? = paused_at.present?

#paused_forObject



26
27
28
# File 'app/models/flightdeck/queue_stats.rb', line 26

def paused_for
  paused_at && Time.current - paused_at
end

#rate_per_hourObject



30
# File 'app/models/flightdeck/queue_stats.rb', line 30

def rate_per_hour = completed_in_window