lib/stackify-api-ruby.rb in stackify-api-ruby-1.0.0 vs lib/stackify-api-ruby.rb in stackify-api-ruby-1.0.1

- old
+ new

@@ -1,8 +1,8 @@ require 'stackify/version' require 'stackify/utils/methods' -require 'active_support/core_ext' unless defined? Rails +require 'core_ext/core_ext' unless defined? Rails module Stackify INTERNAL_LOG_PREFIX = '[Stackify]'.freeze STATUSES = { working: 'working', terminating: 'terminating', terminated: 'terminated'} @@ -37,18 +37,18 @@ def configuration @config ||= Stackify::Configuration.new end def setup + @workers = [] yield(configuration) if block_given? if configuration.is_valid? @status = STATUSES[:working] - @workers = [] else msg = "Stackify's configuration is not valid!" configuration.errors.each do |error_msg| - msg += "\n"+error_msg + msg += "\n" + error_msg end raise msg end end @@ -68,10 +68,11 @@ def logger self.configuration.logger end def shutdown_all caller_obj=nil + Stackify.status = Stackify::STATUSES[:terminating] @workers.each do |worker| worker.shutdown! unless worker.equal? caller_obj end end @@ -114,9 +115,11 @@ end unless async t1.join t2.join if t2 end + else + Stackify.log_internal_error "Stackify is not properly configured! Errors: #{Stackify.configuration.errors}" end end def start_logging Thread.new { Stackify.logs_sender.start}