lib/rails-cloud-tasks.rb in rails-cloud-tasks-0.0.2 vs lib/rails-cloud-tasks.rb in rails-cloud-tasks-0.0.3

- old
+ new

@@ -10,10 +10,11 @@ autoload :Credentials autoload :Adapter autoload :AppEngine autoload :Configuration autoload :Version + autoload :Instrumentation module Rack extend ActiveSupport::Autoload autoload :Jobs @@ -36,7 +37,24 @@ @logger ||= (Rails.logger || Logger.new($stdout)).tap do |logger| logger.formatter = proc do |severity, datetime, _progname, msg| "[#{datetime}] #{severity} [rails-cloud-tasks]: #{msg}\n" end end + end + + @queue_adapter = nil + + def queue_adapter + @@queue_adapter + end + + def self.queue_adapter + @queue_adapter ||= Adapter.new + rescue StandardError => e + raise e unless Rails.env.development? + + logger.warn('unable to setup adapter, falling back to :inline') + logger.warn(e) + + :inline end end