lib/ldclient-rb/polling.rb in ldclient-rb-3.0.1 vs lib/ldclient-rb/polling.rb in ldclient-rb-3.0.2
- old
+ new
@@ -15,20 +15,20 @@
@initialized.value
end
def start
return unless @started.make_true
- @config.logger.info("[LDClient] Initializing polling connection")
+ @config.logger.info { "[LDClient] Initializing polling connection" }
create_worker
end
def stop
if @stopped.make_true
if @worker && @worker.alive?
@worker.raise "shutting down client"
end
- @config.logger.info("[LDClient] Polling connection stopped")
+ @config.logger.info { "[LDClient] Polling connection stopped" }
end
end
def poll
all_data = @requestor.request_all_data
@@ -36,30 +36,30 @@
@config.feature_store.init({
FEATURES => all_data[:flags],
SEGMENTS => all_data[:segments]
})
if @initialized.make_true
- @config.logger.info("[LDClient] Polling connection initialized")
+ @config.logger.info { "[LDClient] Polling connection initialized" }
end
end
end
def create_worker
@worker = Thread.new do
- @config.logger.debug("[LDClient] Starting polling worker")
+ @config.logger.debug { "[LDClient] Starting polling worker" }
while !@stopped.value do
begin
started_at = Time.now
poll
delta = @config.poll_interval - (Time.now - started_at)
if delta > 0
sleep(delta)
end
rescue InvalidSDKKeyError
- @config.logger.error("[LDClient] Received 401 error, no further polling requests will be made since SDK key is invalid");
+ @config.logger.error { "[LDClient] Received 401 error, no further polling requests will be made since SDK key is invalid" };
stop
rescue StandardError => exn
- @config.logger.error("[LDClient] Exception while polling: #{exn.inspect}")
+ @config.logger.error { "[LDClient] Exception while polling: #{exn.inspect}" }
# TODO: log_exception(__method__.to_s, exn)
end
end
end
end