lib/sidekiq/expected_failures/middleware.rb in sidekiq-expected_failures-0.3.0 vs lib/sidekiq/expected_failures/middleware.rb in sidekiq-expected_failures-0.4.0
- old
+ new
@@ -24,31 +24,31 @@
log_exception(data, ex, msg)
end
private
- def setup_exceptions(worker)
- @handled_exceptions = worker.class.get_sidekiq_options['expected_failures'] || Sidekiq.expected_failures
- end
+ def setup_exceptions(worker)
+ @handled_exceptions = worker.class.get_sidekiq_options['expected_failures'] || Sidekiq.expected_failures
+ end
- def exception_intervals(ex)
- [handled_exceptions[ex.class]].flatten.compact
- end
+ def exception_intervals(ex)
+ [handled_exceptions[ex.class]].flatten.compact
+ end
- def log_exception(data, ex, msg)
- result = Sidekiq.redis do |conn|
- conn.multi do |m|
- m.lpush("expected:#{today}", Sidekiq.dump_json(data))
- m.sadd("expected:dates", today)
- m.hincrby("expected:count", data[:exception], 1)
- end
+ def log_exception(data, ex, msg)
+ result = Sidekiq.redis do |conn|
+ conn.multi do |m|
+ m.lpush("expected:#{today}", Sidekiq.dump_json(data))
+ m.sadd("expected:dates", today)
+ m.hincrby("expected:count", data[:exception], 1)
end
-
- handle_exception(ex, msg) if exception_intervals(ex).include?(result[0])
end
- def today
- Date.today.to_s
- end
+ handle_exception(ex, msg) if exception_intervals(ex).include?(result[0])
+ end
+
+ def today
+ Date.today.to_s
+ end
end
end
end