Class: CopycopterClient::Poller
- Inherits:
-
Object
- Object
- CopycopterClient::Poller
- Defined in:
- lib/copycopter_client/poller.rb
Overview
Starts a background thread that continually resynchronizes with the remote server using the given Cache after a set delay.
Instance Method Summary collapse
-
#initialize(cache, options) ⇒ Poller
constructor
A new instance of Poller.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(cache, options) ⇒ Poller
Returns a new instance of Poller.
11 12 13 14 15 16 |
# File 'lib/copycopter_client/poller.rb', line 11 def initialize(cache, ) @cache = cache @polling_delay = [:polling_delay] @logger = [:logger] @stop = false end |
Instance Method Details
#start ⇒ Object
18 19 20 |
# File 'lib/copycopter_client/poller.rb', line 18 def start Thread.new { poll } or logger.error("Couldn't start poller thread") end |
#stop ⇒ Object
22 23 24 |
# File 'lib/copycopter_client/poller.rb', line 22 def stop @stop = true end |