Class: SayWhen::Poller::CelluloidPoller
- Inherits:
-
Object
- Object
- SayWhen::Poller::CelluloidPoller
- Includes:
- Celluloid, BasePoller
- Defined in:
- lib/say_when/poller/celluloid_poller.rb
Instance Method Summary collapse
-
#initialize(tick = nil) ⇒ CelluloidPoller
constructor
A new instance of CelluloidPoller.
- #start ⇒ Object
- #stop ⇒ Object
Methods included from BasePoller
#acquire, #error_tick_length, included, #job_error, #logger, #process, #process_jobs, #processor, #release, #reset_acquired, #reset_acquired_length, #storage, #tick, #tick_length
Constructor Details
#initialize(tick = nil) ⇒ CelluloidPoller
Returns a new instance of CelluloidPoller.
18 19 20 21 |
# File 'lib/say_when/poller/celluloid_poller.rb', line 18 def initialize(tick = nil) @tick_length = tick.to_i if tick start end |
Instance Method Details
#start ⇒ Object
23 24 25 |
# File 'lib/say_when/poller/celluloid_poller.rb', line 23 def start @tick_timer = every(tick_length) { process_jobs } end |
#stop ⇒ Object
27 28 29 30 31 32 |
# File 'lib/say_when/poller/celluloid_poller.rb', line 27 def stop if @tick_timer @tick_timer.cancel @tick_timer = nil end end |