resque 1.18.6 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of resque might be problematic. Click here for more details.

data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
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
+
1
7
  ## 1.18.6 (2011-08-30)
2
8
 
3
9
  * Bugfix: Use Rails 3 eager loading for resque:preload
@@ -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
@@ -4,6 +4,8 @@ rescue LoadError
4
4
  raise "Can't find 'hoptoad_notifier' gem. Please add it to your Gemfile or install it."
5
5
  end
6
6
 
7
+ require 'resque/failure/thoughtbot'
8
+
7
9
  module Resque
8
10
  module Failure
9
11
  # A Failure backend that sends exceptions raised by jobs to Hoptoad.
@@ -23,26 +25,9 @@ module Resque
23
25
  # end
24
26
  # For more information see https://github.com/thoughtbot/hoptoad_notifier
25
27
  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
45
29
 
30
+ @klass = ::HoptoadNotifier
46
31
  end
47
32
  end
48
33
  end
@@ -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
@@ -176,6 +176,13 @@ module Resque
176
176
  redirect u('failed')
177
177
  end
178
178
 
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
+
179
186
  get "/failed/requeue/:index" do
180
187
  Resque::Failure.requeue(params[:index])
181
188
  if request.xhr?
@@ -16,10 +16,6 @@ table, caption, tbody, tfoot, thead, tr, th, td {
16
16
  font-family: inherit;
17
17
  }
18
18
 
19
- :focus {
20
- outline: 0;
21
- }
22
-
23
19
  body {
24
20
  line-height: 1;
25
21
  }
@@ -80,6 +80,6 @@ body { padding:0; margin:0; }
80
80
  #main p.pagination a.less { float:left;}
81
81
  #main p.pagination a.more { float:right;}
82
82
 
83
- #main form {float:right; margin-top:-10px;}
83
+ #main form {float:right; margin-top:-10px;margin-left:10px;}
84
84
 
85
85
  #main .time a.toggle_format {text-decoration:none;}
@@ -5,9 +5,12 @@
5
5
 
6
6
  <h1>Failed Jobs</h1>
7
7
  <%unless failed.empty?%>
8
- <form method="POST" action="<%=u 'failed/clear'%>" class='clear-failed'>
8
+ <form method="POST" action="<%=u 'failed/clear'%>">
9
9
  <input type='submit' name='' value='Clear Failed Jobs' />
10
10
  </form>
11
+ <form method="POST" action="<%=u 'failed/requeue/all'%>">
12
+ <input type='submit' name='' value='Retry Failed Jobs' />
13
+ </form>
11
14
  <%end%>
12
15
 
13
16
  <p class='sub'>Showing <%=start%> to <%= start + 20 %> of <b><%= size = Resque::Failure.count %></b> jobs</p>
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.18.6'
2
+ Version = VERSION = '1.19.0'
3
3
  end
@@ -0,0 +1,27 @@
1
+
2
+ require 'test_helper'
3
+
4
+ begin
5
+ require 'airbrake'
6
+ rescue LoadError
7
+ warn "Install airbrake gem to run Airbrake tests."
8
+ end
9
+
10
+ if defined? Airbrake
11
+ require 'resque/failure/airbrake'
12
+ context "Airbrake" do
13
+ test "should be notified of an error" do
14
+ exception = StandardError.new("BOOM")
15
+ worker = Resque::Worker.new(:test)
16
+ queue = "test"
17
+ payload = {'class' => Object, 'args' => 66}
18
+
19
+ Airbrake.expects(:notify_or_ignore).with(
20
+ exception,
21
+ :parameters => {:payload_class => 'Object', :payload_args => '66'})
22
+
23
+ backend = Resque::Failure::Airbrake.new(exception, worker, queue, payload)
24
+ backend.save
25
+ end
26
+ end
27
+ end
@@ -7,6 +7,7 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  if defined? HoptoadNotifier
10
+ require 'resque/failure/hoptoad'
10
11
  context "Hoptoad" do
11
12
  test "should be notified of an error" do
12
13
  exception = StandardError.new("BOOM")
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque
3
3
  version: !ruby/object:Gem::Version
4
- hash: 83
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 1
8
- - 18
9
- - 6
10
- version: 1.18.6
7
+ - 19
8
+ - 0
9
+ version: 1.19.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Chris Wanstrath
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-08-30 00:00:00 -07:00
17
+ date: 2011-09-02 00:00:00 -07:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 19
30
28
  segments:
31
29
  - 1
32
30
  - 0
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- hash: 31
46
43
  segments:
47
44
  - 0
48
45
  - 1
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- hash: 63
62
58
  segments:
63
59
  - 0
64
60
  - 9
@@ -74,7 +70,6 @@ dependencies:
74
70
  requirements:
75
71
  - - ~>
76
72
  - !ruby/object:Gem::Version
77
- hash: 15
78
73
  segments:
79
74
  - 1
80
75
  - 0
@@ -97,10 +92,12 @@ files:
97
92
  - LICENSE
98
93
  - HISTORY.md
99
94
  - lib/resque/errors.rb
95
+ - lib/resque/failure/airbrake.rb
100
96
  - lib/resque/failure/base.rb
101
97
  - lib/resque/failure/hoptoad.rb
102
98
  - lib/resque/failure/multiple.rb
103
99
  - lib/resque/failure/redis.rb
100
+ - lib/resque/failure/thoughtbot.rb
104
101
  - lib/resque/failure.rb
105
102
  - lib/resque/helpers.rb
106
103
  - lib/resque/job.rb
@@ -136,6 +133,7 @@ files:
136
133
  - lib/tasks/resque.rake
137
134
  - bin/resque
138
135
  - bin/resque-web
136
+ - test/airbrake_test.rb
139
137
  - test/hoptoad_test.rb
140
138
  - test/job_hooks_test.rb
141
139
  - test/job_plugins_test.rb
@@ -159,7 +157,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
157
  requirements:
160
158
  - - ">="
161
159
  - !ruby/object:Gem::Version
162
- hash: 3
163
160
  segments:
164
161
  - 0
165
162
  version: "0"
@@ -168,14 +165,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
165
  requirements:
169
166
  - - ">="
170
167
  - !ruby/object:Gem::Version
171
- hash: 3
172
168
  segments:
173
169
  - 0
174
170
  version: "0"
175
171
  requirements: []
176
172
 
177
173
  rubyforge_project:
178
- rubygems_version: 1.5.2
174
+ rubygems_version: 1.3.7
179
175
  signing_key:
180
176
  specification_version: 3
181
177
  summary: Resque is a Redis-backed queueing system.