lib/tracebin/agent.rb in tracebin-0.0.8 vs lib/tracebin/agent.rb in tracebin-0.0.9

- old
+ new

@@ -10,28 +10,35 @@ module Agent class << self attr_accessor :config, :storage, :logger def start! + return if started? || !config.enabled + logger.info "TRACEBIN: Starting Tracebin agent..." @subscribers = Subscribers.new @health_monitor = HealthMonitor.start @worker_process_monitor = WorkerProcessMonitor.start @reporter = Reporter.new(storage, config, logger) @reporter.start! + @started = true logger.info "TRACEBIN: Tracebin agent started!" end def stop! + return unless started? + logger.info "TRACEBIN: Shutting down Tracebin agent..." @health_monitor.stop! @worker_process_monitor.stop! @reporter.stop! + + storage.unload @started = false logger.info "TRACEBIN: Tracebin agent stopped!" end