Skip to content

Commit 8996224

Browse files
author
mpd
committed
Merge branch 'defunkt' into distributed
2 parents 22d1fe1 + 11f3fac commit 8996224

File tree

17 files changed

+126
-33
lines changed

17 files changed

+126
-33
lines changed

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ group :test do
99
gem "leftright", :platforms => :mri_18
1010
gem "yajl-ruby", "~>0.8.2", :platforms => :mri
1111
gem "json", "~>1.5.3", :platforms => [:jruby, :rbx]
12+
gem "hoptoad_notifier"
13+
gem "airbrake"
14+
gem "i18n"
1215
end

HISTORY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 1.19.0 (2011-09-01)
2+
3+
* Added Airbrake (formerly Hoptoad) support.
4+
* Web UI: Added retry all button to failed jobs page
5+
* Web UI: Show focus outline
6+
7+
## 1.18.6 (2011-08-30)
8+
9+
* Bugfix: Use Rails 3 eager loading for resque:preload
10+
111
## 1.18.5 (2011-08-24)
212

313
* Added support for Travis CI

README.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,14 @@ run Rack::URLMap.new \
469469
Check `examples/demo/config.ru` for a functional example (including
470470
HTTP basic auth).
471471

472+
### Rails 3
473+
474+
You can also easily mount Resque on a subpath in your existing Rails 3 app by adding this to your `routes.rb`:
475+
476+
``` ruby
477+
mount Resque::Server.new, :at => "/resque"
478+
```
479+
472480

473481
Resque vs DelayedJob
474482
--------------------

examples/god/resque.god

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ num_workers.times do |num|
1414
w.uid = 'git'
1515
w.gid = 'git'
1616

17-
# retart if memory gets too high
17+
# restart if memory gets too high
1818
w.transition(:up, :restart) do |on|
1919
on.condition(:memory_usage) do |c|
2020
c.above = 350.megabytes

lib/resque/failure/airbrake.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
begin
2+
require 'airbrake'
3+
rescue LoadError
4+
raise "Can't find 'airbrake' gem. Please add it to your Gemfile or install it."
5+
end
6+
7+
require 'resque/failure/thoughtbot'
8+
9+
module Resque
10+
module Failure
11+
class Airbrake < Base
12+
include Resque::Failure::Thoughtbot
13+
14+
@klass = ::Airbrake
15+
end
16+
end
17+
end

lib/resque/failure/hoptoad.rb

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
raise "Can't find 'hoptoad_notifier' gem. Please add it to your Gemfile or install it."
55
end
66

7+
require 'resque/failure/thoughtbot'
8+
79
module Resque
810
module Failure
911
# A Failure backend that sends exceptions raised by jobs to Hoptoad.
@@ -23,26 +25,9 @@ module Failure
2325
# end
2426
# For more information see https://github.com/thoughtbot/hoptoad_notifier
2527
class Hoptoad < Base
26-
def self.configure(&block)
27-
Resque::Failure.backend = self
28-
HoptoadNotifier.configure(&block)
29-
end
30-
31-
def self.count
32-
# We can't get the total # of errors from Hoptoad so we fake it
33-
# by asking Resque how many errors it has seen.
34-
Stat[:failed]
35-
end
36-
37-
def save
38-
HoptoadNotifier.notify_or_ignore(exception,
39-
:parameters => {
40-
:payload_class => payload['class'].to_s,
41-
:payload_args => payload['args'].inspect
42-
}
43-
)
44-
end
28+
include Resque::Failure::Thoughtbot
4529

30+
@klass = ::HoptoadNotifier
4631
end
4732
end
4833
end

lib/resque/failure/thoughtbot.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module Resque
2+
module Failure
3+
module Thoughtbot
4+
def self.included(base)
5+
base.extend(ClassMethods)
6+
end
7+
8+
module ClassMethods
9+
attr_accessor :klass
10+
11+
def configure(&block)
12+
Resque::Failure.backend = self
13+
klass.configure(&block)
14+
end
15+
16+
def count
17+
# We can't get the total # of errors from Hoptoad so we fake it
18+
# by asking Resque how many errors it has seen.
19+
Stat[:failed]
20+
end
21+
end
22+
23+
def save
24+
self.class.klass.notify_or_ignore(exception,
25+
:parameters => {
26+
:payload_class => payload['class'].to_s,
27+
:payload_args => payload['args'].inspect
28+
}
29+
)
30+
end
31+
end
32+
end
33+
end

lib/resque/server.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ def show_for_polling(page)
176176
redirect u('failed')
177177
end
178178

179+
post "/failed/requeue/all" do
180+
Resque::Failure.count.times do |num|
181+
Resque::Failure.requeue(num)
182+
end
183+
redirect u('failed')
184+
end
185+
179186
get "/failed/requeue/:index" do
180187
Resque::Failure.requeue(params[:index])
181188
if request.xhr?

lib/resque/server/public/reset.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ table, caption, tbody, tfoot, thead, tr, th, td {
1616
font-family: inherit;
1717
}
1818

19-
:focus {
20-
outline: 0;
21-
}
22-
2319
body {
2420
line-height: 1;
2521
}

lib/resque/server/public/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ body { padding:0; margin:0; }
8080
#main p.pagination a.less { float:left;}
8181
#main p.pagination a.more { float:right;}
8282

83-
#main form {float:right; margin-top:-10px;}
83+
#main form {float:right; margin-top:-10px;margin-left:10px;}
8484

8585
#main .time a.toggle_format {text-decoration:none;}

0 commit comments

Comments
 (0)