forked from resque/resque
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'defunkt' into distributed
- Loading branch information
Showing
17 changed files
with
126 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
begin | ||
require 'airbrake' | ||
rescue LoadError | ||
raise "Can't find 'airbrake' gem. Please add it to your Gemfile or install it." | ||
end | ||
|
||
require 'resque/failure/thoughtbot' | ||
|
||
module Resque | ||
module Failure | ||
class Airbrake < Base | ||
include Resque::Failure::Thoughtbot | ||
|
||
@klass = ::Airbrake | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Resque | ||
module Failure | ||
module Thoughtbot | ||
def self.included(base) | ||
base.extend(ClassMethods) | ||
end | ||
|
||
module ClassMethods | ||
attr_accessor :klass | ||
|
||
def configure(&block) | ||
Resque::Failure.backend = self | ||
klass.configure(&block) | ||
end | ||
|
||
def count | ||
# We can't get the total # of errors from Hoptoad so we fake it | ||
# by asking Resque how many errors it has seen. | ||
Stat[:failed] | ||
end | ||
end | ||
|
||
def save | ||
self.class.klass.notify_or_ignore(exception, | ||
:parameters => { | ||
:payload_class => payload['class'].to_s, | ||
:payload_args => payload['args'].inspect | ||
} | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Resque | ||
Version = VERSION = '1.18.5' | ||
Version = VERSION = '1.19.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' | ||
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib' | ||
require 'resque/tasks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
require 'test_helper' | ||
|
||
begin | ||
require 'airbrake' | ||
rescue LoadError | ||
warn "Install airbrake gem to run Airbrake tests." | ||
end | ||
|
||
if defined? Airbrake | ||
require 'resque/failure/airbrake' | ||
context "Airbrake" do | ||
test "should be notified of an error" do | ||
exception = StandardError.new("BOOM") | ||
worker = Resque::Worker.new(:test) | ||
queue = "test" | ||
payload = {'class' => Object, 'args' => 66} | ||
|
||
Airbrake.expects(:notify_or_ignore).with( | ||
exception, | ||
:parameters => {:payload_class => 'Object', :payload_args => '66'}) | ||
|
||
backend = Resque::Failure::Airbrake.new(exception, worker, queue, payload) | ||
backend.save | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters