Class: EventSourcery::Postgres::QueueWithIntervalCallback

Inherits:
Queue
  • Object
show all
Defined in:
lib/event_sourcery/postgres/queue_with_interval_callback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callback: proc {}, callback_interval: EventSourcery::Postgres.config.callback_interval_if_no_new_events, poll_interval: 0.1) ⇒ QueueWithIntervalCallback

Returns a new instance of QueueWithIntervalCallback.



6
7
8
9
10
11
# File 'lib/event_sourcery/postgres/queue_with_interval_callback.rb', line 6

def initialize(callback: proc {}, callback_interval: EventSourcery::Postgres.config.callback_interval_if_no_new_events, poll_interval: 0.1)
  @callback = callback
  @callback_interval = callback_interval
  @poll_interval = poll_interval
  super()
end

Instance Attribute Details

#callbackObject

Returns the value of attribute callback.



4
5
6
# File 'lib/event_sourcery/postgres/queue_with_interval_callback.rb', line 4

def callback
  @callback
end

Instance Method Details

#pop(non_block_without_callback = false) ⇒ Object



13
14
15
16
# File 'lib/event_sourcery/postgres/queue_with_interval_callback.rb', line 13

def pop(non_block_without_callback = false)
  return super if non_block_without_callback
  pop_with_interval_callback
end