Class: Push::Daemon::Feedback::FeedbackFeeder
- Inherits:
-
Object
- Object
- Push::Daemon::Feedback::FeedbackFeeder
- Includes:
- DatabaseReconnectable, InterruptibleSleep
- Defined in:
- lib/push/daemon/feedback/feedback_feeder.rb
Instance Method Summary collapse
-
#initialize(poll) ⇒ FeedbackFeeder
constructor
A new instance of FeedbackFeeder.
- #name ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Methods included from InterruptibleSleep
#interrupt_sleep, #interruptible_sleep
Methods included from DatabaseReconnectable
#adaptor_errors, #check_database_is_connected, #database_connection_lost, #reconnect_database, #sleep_to_avoid_thrashing, #with_database_reconnect_and_retry
Constructor Details
#initialize(poll) ⇒ FeedbackFeeder
Returns a new instance of FeedbackFeeder.
8 9 10 |
# File 'lib/push/daemon/feedback/feedback_feeder.rb', line 8 def initialize(poll) @poll = poll end |
Instance Method Details
#name ⇒ Object
12 13 14 |
# File 'lib/push/daemon/feedback/feedback_feeder.rb', line 12 def name "FeedbackFeeder" end |
#start ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/push/daemon/feedback/feedback_feeder.rb', line 16 def start Thread.new do loop do interruptible_sleep @poll break if @stop enqueue_feedback end end end |
#stop ⇒ Object
26 27 28 29 |
# File 'lib/push/daemon/feedback/feedback_feeder.rb', line 26 def stop @stop = true interrupt_sleep end |