influxdb/influxdb-ruby — pull request #66 by chingor13 (2014-10-10 22:00:10+00:00)
Title: Prevent at_exit hook from hanging for async client

Problem: if you your connection(s) to your influxdb server(s) fail in the at_exit handling of the background queue, and you have infinite retries enabled (which is default), your process will block and never exit.

The client tries to register itself as stopped in its at_exit hook, but the ones inside the spawned threads always run first. By moving the at_exit hook outside of the spawned threads, the client will mark itself as stopped and won't retry failed sends.

The slight downside is that you no longer have 3 threads processing trying to process your unsent queue. Alternatively, we could leave the at_exit block in the spawned threads and have them all mark the client as stopped before trying to check_background_queue