Class: SharedWorkforce::ResponsePoller
- Inherits:
-
Object
- Object
- SharedWorkforce::ResponsePoller
- Defined in:
- lib/shared_workforce/response_poller.rb
Class Method Summary collapse
-
.start(interval = 60) ⇒ Object
The response poller is intended for use during local development only.
Instance Method Summary collapse
Class Method Details
.start(interval = 60) ⇒ Object
The response poller is intended for use during local development only. It facilitates real world task responses without needing an open socket for the web hooks.
7 8 9 |
# File 'lib/shared_workforce/response_poller.rb', line 7 def self.start(interval=60) new.start(interval) end |
Instance Method Details
#start(interval) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shared_workforce/response_poller.rb', line 11 def start(interval) Thread.abort_on_exception = true Thread.new do SharedWorkforce.logger.info "SharedWorkforce: Checking every #{interval} seconds for new responses." while true SharedWorkforce.logger.info "SharedWorkforce: Checking for new task responses." process_tasks completed_tasks sleep interval end end end |