Class: EventSourcery::Postgres::QueueWithIntervalCallback
- Inherits:
-
Queue
- Object
- Queue
- EventSourcery::Postgres::QueueWithIntervalCallback
- Defined in:
- lib/event_sourcery/postgres/queue_with_interval_callback.rb
Overview
Queue that invokes a callback at regular intervals when no items are available.
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
Instance Method Summary collapse
-
#initialize(callback: proc {}, callback_interval: EventSourcery::Postgres.config.callback_interval_if_no_new_events, poll_interval: 0.1) ⇒ QueueWithIntervalCallback
constructor
A new instance of QueueWithIntervalCallback.
-
#pop(non_block_without_callback = false) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter.
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.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/event_sourcery/postgres/queue_with_interval_callback.rb', line 9 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
#callback ⇒ Object
Returns the value of attribute callback.
7 8 9 |
# File 'lib/event_sourcery/postgres/queue_with_interval_callback.rb', line 7 def callback @callback end |
Instance Method Details
#pop(non_block_without_callback = false) ⇒ Object
rubocop:disable Style/OptionalBooleanParameter
20 21 22 23 24 |
# File 'lib/event_sourcery/postgres/queue_with_interval_callback.rb', line 20 def pop(non_block_without_callback = false) # rubocop:disable Style/OptionalBooleanParameter return super if non_block_without_callback pop_with_interval_callback end |