Method: Flagsmith::AnalyticsProcessor#flush

Defined in:
lib/flagsmith/sdk/analytics_processor.rb

#flushObject

Sends all the collected data to the api asynchronously and resets the timer



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/flagsmith/sdk/analytics_processor.rb', line 26

def flush
  return if @analytics_data.empty?

  begin
    @api_client.post(ENDPOINT, @analytics_data.to_json)
    @analytics_data = {}
  rescue StandardError => e
    @logger.warn "Temporarily unable to access flag analytics endpoint for exception: #{e}"
  end

  @last_flushed = Time.now
end