lib/metriksd/librato_metrics_reporter.rb in metriksd-0.5.2 vs lib/metriksd/librato_metrics_reporter.rb in metriksd-0.5.3
- old
+ new
@@ -49,10 +49,23 @@
rollup = Metriksd::LibratoMetricsReporter::TimesliceRollup.new(timeslice)
@queue.add rollup.to_hash
end
unless queue.empty?
- @queue.submit
+ attempts = 3
+
+ begin
+ @queue.submit
+ rescue => e
+ if attempts > 0
+ puts "Exception from librato metrics. retrying: #{e.class}: #{e.backtrace.join("\n\t")}"
+ sleep attempts + 1
+ attempts -= 1
+ retry
+ else
+ puts "Exception from librato metrics. dropping: #{e.class}: #{e.backtrace.join("\n\t")}"
+ end
+ end
end
end
def sleep_until_deadline
now = Time.now.to_f