lib/ldclient-rb/polling.rb in ldclient-rb-5.5.2 vs lib/ldclient-rb/polling.rb in ldclient-rb-5.5.3
- old
+ new
@@ -24,11 +24,11 @@
@ready
end
def stop
if @stopped.make_true
- if @worker && @worker.alive?
+ if @worker && @worker.alive? && @worker != Thread.current
@worker.run # causes the thread to wake up if it's currently in a sleep
@worker.join
end
@config.logger.info { "[LDClient] Polling connection stopped" }
end
@@ -61,11 +61,10 @@
if !Util.http_error_recoverable?(e.status)
@ready.set # if client was waiting on us, make it stop waiting - has no effect if already set
stop
end
rescue StandardError => exn
- @config.logger.error { "[LDClient] Exception while polling: #{exn.inspect}" }
- # TODO: log_exception(__method__.to_s, exn)
+ Util.log_exception(@config.logger, "Exception while polling", exn)
end
delta = @config.poll_interval - (Time.now - started_at)
if delta > 0
sleep(delta)
end