lib/lambda_punch.rb in lambda_punch-0.0.8 vs lib/lambda_punch.rb in lambda_punch-1.0.0
- old
+ new
@@ -11,11 +11,14 @@
require 'lambda_punch/queue'
require 'lambda_punch/server'
require 'lambda_punch/worker'
require 'lambda_punch/version'
require 'lambda_punch/notifier'
-require 'lambda_punch/railtie' if defined?(Rails)
+if defined?(Rails)
+ require 'lambda_punch/railtie'
+ require 'lambda_punch/rails/active_job'
+end
module LambdaPunch
def push(&block)
Queue.push(block)
@@ -41,9 +44,19 @@
@logger ||= Logger.new.logger
end
def handled!(context)
Notifier.handled!(context)
+ end
+
+ def error_handler
+ @error_handler ||= lambda do |e|
+ logger.error "Queue#call::error => #{e.message}"
+ end
+ end
+
+ def error_handler=(func)
+ @error_handler = func
end
extend self
end