influxdb/influxdb-rails — pull request #15 by chingor13 (2014-10-02 21:31:46+00:00)
Title: Lazy create and memoize InfluxDB::Rails.client

Instantiating an async InfluxDB::Client creates thread workers. With the basic
setup suggested in the README, we call the InfluxDB::Rails.configure block
twice which creates 2 client instances (which each start InfluxDB::Workers)

This also fixes #14 for people using unicorn. If we create the client (and async workers) before unicorn forks, the async workers are running in the unicorn master but not the unicorn workers. Events don't get reported until the at_exit handler runs on the unicorn master. By lazy loading the client, each unicorn worker will have async worker threads to report to influxdb.