Class: Resque::Plugins::NotiFailure::Failure
- Inherits:
-
Failure::Base
- Object
- Failure::Base
- Resque::Plugins::NotiFailure::Failure
- Defined in:
- lib/resque/plugins/noti_failure/failure.rb
Class Method Summary collapse
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .count(queue = nil, class_name = nil) ⇒ Object
Instance Method Summary collapse
Class Method Details
.configuration ⇒ Object
5 6 7 |
# File 'lib/resque/plugins/noti_failure/failure.rb', line 5 def self.configuration @configuration ||= Resque::Plugins::NotiFailure::Configuration.new end |
.configure {|configuration| ... } ⇒ Object
9 10 11 |
# File 'lib/resque/plugins/noti_failure/failure.rb', line 9 def self.configure yield(configuration) end |
.count(queue = nil, class_name = nil) ⇒ Object
13 14 15 16 17 |
# File 'lib/resque/plugins/noti_failure/failure.rb', line 13 def self.count(queue = nil, class_name = nil) # We can't get the total # of errors from Noti so we fake it # by asking Resque how many errors it has seen. Stat[:failed] end |
Instance Method Details
#save ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/resque/plugins/noti_failure/failure.rb', line 19 def save notification = ::Noti::Notification.new notification.title = Resque::Plugins::NotiFailure::Failure.configuration.failure_name notification.url = Resque::Plugins::NotiFailure::Failure.configuration.failure_url notification.text = Resque::Plugins::NotiFailure::Failure.configuration..call(payload) Resque.redis.smembers('noti-users').each do |token| begin notification.deliver_to token rescue Noti::Errors::AccessDenied Resque.redis.srem('noti-users', token) rescue => error Resque.logger.warn("Error sending noti failure : #{error.}") end end end |