Class: Featureflip::DataSource::PollingHandler
- Inherits:
-
Object
- Object
- Featureflip::DataSource::PollingHandler
- Defined in:
- lib/featureflip/data_source/polling.rb
Instance Method Summary collapse
-
#initialize(http_client:, config:, on_update:, on_error:) ⇒ PollingHandler
constructor
A new instance of PollingHandler.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(http_client:, config:, on_update:, on_error:) ⇒ PollingHandler
Returns a new instance of PollingHandler.
4 5 6 7 8 9 10 11 |
# File 'lib/featureflip/data_source/polling.rb', line 4 def initialize(http_client:, config:, on_update:, on_error:) @http_client = http_client @config = config @on_update = on_update @on_error = on_error @stop_flag = false @thread = nil end |
Instance Method Details
#start ⇒ Object
13 14 15 16 |
# File 'lib/featureflip/data_source/polling.rb', line 13 def start @stop_flag = false @thread = Thread.new { run } end |
#stop ⇒ Object
18 19 20 21 22 23 |
# File 'lib/featureflip/data_source/polling.rb', line 18 def stop @stop_flag = true @thread&.wakeup rescue nil @thread&.join(5) @thread = nil end |