resque 1.9.5 → 1.9.7

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,14 @@
1
+ ## 1.9.7 (2010-07-09)
2
+
3
+ * Improved memory usage in Job.destroy
4
+ * redis-namespace 0.7.0 now required
5
+ * Bugfix: Reverted $0 changes
6
+ * Web Bugfix: Payload-less failures in the web ui work
7
+
8
+ ## 1.9.6 (2010-06-22)
9
+
10
+ * Bugfix: Rakefile logging works the same as all the other logging
11
+
1
12
  ## 1.9.5 (2010-06-16)
2
13
 
3
14
  * Web Bugfix: Display the configured namespace on the stats page
@@ -80,15 +80,14 @@ module Resque
80
80
  queue = "queue:#{queue}"
81
81
  destroyed = 0
82
82
 
83
- redis.lrange(queue, 0, -1).each do |string|
84
- json = decode(string)
85
-
86
- match = json['class'] == klass
87
- match &= json['args'] == args unless args.empty?
88
-
89
- if match
90
- destroyed += redis.lrem(queue, 0, string).to_i
83
+ if args.empty?
84
+ redis.lrange(queue, 0, -1).each do |string|
85
+ if decode(string)['class'] == klass
86
+ destroyed += redis.lrem(queue, 0, string).to_i
87
+ end
91
88
  end
89
+ else
90
+ destroyed += redis.lrem(queue, 0, encode(:class => klass, :args => args))
92
91
  end
93
92
 
94
93
  destroyed
@@ -28,9 +28,9 @@
28
28
  </div>
29
29
  </dd>
30
30
  <dt>Class</dt>
31
- <dd><code><%= job['payload']['class'] %></code></dd>
31
+ <dd><code><%= job['payload'] ? job['payload']['class'] : 'nil' %></code></dd>
32
32
  <dt>Arguments</dt>
33
- <dd><pre><%=h show_args(job['payload']['args']) %></pre></dd>
33
+ <dd><pre><%=h job['payload'] ? show_args(job['payload']['args']) : 'nil' %></pre></dd>
34
34
  <dt>Exception</td>
35
35
  <dd><code><%= job['exception'] %></code></dd>
36
36
  <dt>Error</dt>
@@ -19,7 +19,7 @@ namespace :resque do
19
19
  abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
20
20
  end
21
21
 
22
- puts "*** Starting worker #{worker}"
22
+ worker.log "Starting worker #{worker}"
23
23
 
24
24
  worker.work(ENV['INTERVAL'] || 5) # interval, will block
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.9.5'
2
+ Version = VERSION = '1.9.7'
3
3
  end
@@ -93,7 +93,7 @@ namespace :redis do
93
93
  end
94
94
 
95
95
  %w(redis-benchmark redis-cli redis-server).each do |bin|
96
- sh "cp /tmp/redis/#{bin} #{bin_dir}"
96
+ sh "cp /tmp/redis/src//#{bin} #{bin_dir}"
97
97
  end
98
98
 
99
99
  puts "Installed redis-benchmark, redis-cli and redis-server to #{bin_dir}"
@@ -105,8 +105,8 @@ namespace :redis do
105
105
  end
106
106
 
107
107
  task :make do
108
- sh "cd /tmp/redis && make clean"
109
- sh "cd /tmp/redis && make"
108
+ sh "cd /tmp/redis/src && make clean"
109
+ sh "cd /tmp/redis/src && make"
110
110
  end
111
111
 
112
112
  desc "Download package"
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/test_helper'
3
3
  context "Resque::Job before_perform" do
4
4
  include PerformJob
5
5
 
6
- class BeforePerformJob
6
+ class ::BeforePerformJob
7
7
  def self.before_perform_record_history(history)
8
8
  history << :before_perform
9
9
  end
@@ -19,7 +19,7 @@ context "Resque::Job before_perform" do
19
19
  assert_equal history, [:before_perform, :perform]
20
20
  end
21
21
 
22
- class BeforePerformJobFails
22
+ class ::BeforePerformJobFails
23
23
  def self.before_perform_fail_job(history)
24
24
  history << :before_perform
25
25
  raise StandardError
@@ -37,7 +37,7 @@ context "Resque::Job before_perform" do
37
37
  assert_equal history, [:before_perform], "Only before_perform was run"
38
38
  end
39
39
 
40
- class BeforePerformJobAborts
40
+ class ::BeforePerformJobAborts
41
41
  def self.before_perform_abort(history)
42
42
  history << :before_perform
43
43
  raise Resque::Job::DontPerform
@@ -57,7 +57,7 @@ end
57
57
  context "Resque::Job after_perform" do
58
58
  include PerformJob
59
59
 
60
- class AfterPerformJob
60
+ class ::AfterPerformJob
61
61
  def self.perform(history)
62
62
  history << :perform
63
63
  end
@@ -72,7 +72,7 @@ context "Resque::Job after_perform" do
72
72
  assert_equal history, [:perform, :after_perform]
73
73
  end
74
74
 
75
- class AfterPerformJobFails
75
+ class ::AfterPerformJobFails
76
76
  def self.perform(history)
77
77
  history << :perform
78
78
  end
@@ -94,7 +94,7 @@ end
94
94
  context "Resque::Job around_perform" do
95
95
  include PerformJob
96
96
 
97
- class AroundPerformJob
97
+ class ::AroundPerformJob
98
98
  def self.perform(history)
99
99
  history << :perform
100
100
  end
@@ -111,7 +111,7 @@ context "Resque::Job around_perform" do
111
111
  assert_equal history, [:start_around_perform, :perform, :finish_around_perform]
112
112
  end
113
113
 
114
- class AroundPerformJobFailsBeforePerforming
114
+ class ::AroundPerformJobFailsBeforePerforming
115
115
  def self.perform(history)
116
116
  history << :perform
117
117
  end
@@ -131,7 +131,7 @@ context "Resque::Job around_perform" do
131
131
  assert_equal history, [:start_around_perform], "Only part of around_perform was run"
132
132
  end
133
133
 
134
- class AroundPerformJobFailsWhilePerforming
134
+ class ::AroundPerformJobFailsWhilePerforming
135
135
  def self.perform(history)
136
136
  history << :perform
137
137
  raise StandardError
@@ -155,7 +155,7 @@ context "Resque::Job around_perform" do
155
155
  assert_equal history, [:start_around_perform, :perform, :ensure_around_perform], "Only part of around_perform was run"
156
156
  end
157
157
 
158
- class AroundPerformJobDoesNotHaveToYield
158
+ class ::AroundPerformJobDoesNotHaveToYield
159
159
  def self.perform(history)
160
160
  history << :perform
161
161
  end
@@ -176,7 +176,7 @@ end
176
176
  context "Resque::Job on_failure" do
177
177
  include PerformJob
178
178
 
179
- class FailureJobThatDoesNotFail
179
+ class ::FailureJobThatDoesNotFail
180
180
  def self.perform(history)
181
181
  history << :perform
182
182
  end
@@ -191,7 +191,7 @@ context "Resque::Job on_failure" do
191
191
  assert_equal history, [:perform]
192
192
  end
193
193
 
194
- class FailureJobThatFails
194
+ class ::FailureJobThatFails
195
195
  def self.perform(history)
196
196
  history << :perform
197
197
  raise StandardError, "oh no"
@@ -209,7 +209,7 @@ context "Resque::Job on_failure" do
209
209
  assert_equal history, [:perform, "oh no"]
210
210
  end
211
211
 
212
- class FailureJobThatFailsBadly
212
+ class ::FailureJobThatFailsBadly
213
213
  def self.perform(history)
214
214
  history << :perform
215
215
  raise SyntaxError, "oh no"
@@ -231,7 +231,7 @@ end
231
231
  context "Resque::Job all hooks" do
232
232
  include PerformJob
233
233
 
234
- class VeryHookyJob
234
+ class ::VeryHookyJob
235
235
  def self.before_perform_record_history(history)
236
236
  history << :before_perform
237
237
  end
@@ -263,7 +263,7 @@ context "Resque::Job all hooks" do
263
263
  ]
264
264
  end
265
265
 
266
- class VeryHookyJobThatFails
266
+ class ::VeryHookyJobThatFails
267
267
  def self.before_perform_record_history(history)
268
268
  history << :before_perform
269
269
  end
@@ -21,7 +21,7 @@ context "Multiple plugins with multiple hooks" do
21
21
  end
22
22
  end
23
23
 
24
- class ManyBeforesJob
24
+ class ::ManyBeforesJob
25
25
  extend Plugin1
26
26
  extend Plugin2
27
27
  def self.perform(history)
@@ -45,7 +45,7 @@ context "Resque::Plugin ordering before_perform" do
45
45
  end
46
46
  end
47
47
 
48
- class BeforePerformJob
48
+ class ::BeforePerformJob
49
49
  extend BeforePerformPlugin
50
50
  def self.perform(history)
51
51
  history << :perform
@@ -71,7 +71,7 @@ context "Resque::Plugin ordering after_perform" do
71
71
  end
72
72
  end
73
73
 
74
- class AfterPerformJob
74
+ class ::AfterPerformJob
75
75
  extend AfterPerformPlugin
76
76
  def self.perform(history)
77
77
  history << :perform
@@ -98,7 +98,7 @@ context "Resque::Plugin ordering around_perform" do
98
98
  end
99
99
  end
100
100
 
101
- class AroundPerformJustPerformsJob
101
+ class ::AroundPerformJustPerformsJob
102
102
  extend AroundPerformPlugin1
103
103
  def self.perform(history)
104
104
  history << :perform
@@ -111,7 +111,7 @@ context "Resque::Plugin ordering around_perform" do
111
111
  assert_equal [:around_perform_plugin1, :perform], history
112
112
  end
113
113
 
114
- class AroundPerformJob
114
+ class ::AroundPerformJob
115
115
  extend AroundPerformPlugin1
116
116
  def self.perform(history)
117
117
  history << :perform
@@ -135,7 +135,7 @@ context "Resque::Plugin ordering around_perform" do
135
135
  end
136
136
  end
137
137
 
138
- class AroundPerformJob2
138
+ class ::AroundPerformJob2
139
139
  extend AroundPerformPlugin1
140
140
  extend AroundPerformPlugin2
141
141
  def self.perform(history)
@@ -159,7 +159,7 @@ context "Resque::Plugin ordering around_perform" do
159
159
  end
160
160
  end
161
161
 
162
- class AroundPerformJob3
162
+ class ::AroundPerformJob3
163
163
  extend AroundPerformPlugin1
164
164
  extend AroundPerformPlugin2
165
165
  extend AroundPerformDoesNotYield
@@ -189,7 +189,7 @@ context "Resque::Plugin ordering around_perform" do
189
189
  end
190
190
  end
191
191
 
192
- class AroundPerformJobWithReturnValue < GoodJob
192
+ class ::AroundPerformJobWithReturnValue < GoodJob
193
193
  extend AroundPerformGetsJobResult
194
194
  end
195
195
 
@@ -209,7 +209,7 @@ context "Resque::Plugin ordering on_failure" do
209
209
  end
210
210
  end
211
211
 
212
- class FailureJob
212
+ class ::FailureJob
213
213
  extend OnFailurePlugin
214
214
  def self.perform(history)
215
215
  history << :perform
@@ -19,33 +19,33 @@ context "Resque::Plugin finding hooks" do
19
19
  end
20
20
 
21
21
  test "before_perform hooks are found and sorted" do
22
- assert_equal ["before_perform", "before_perform1", "before_perform2"], Resque::Plugin.before_hooks(SimplePlugin)
22
+ assert_equal ["before_perform", "before_perform1", "before_perform2"], Resque::Plugin.before_hooks(SimplePlugin).map {|m| m.to_s}
23
23
  end
24
24
 
25
25
  test "after_perform hooks are found and sorted" do
26
- assert_equal ["after_perform", "after_perform1", "after_perform2"], Resque::Plugin.after_hooks(SimplePlugin)
26
+ assert_equal ["after_perform", "after_perform1", "after_perform2"], Resque::Plugin.after_hooks(SimplePlugin).map {|m| m.to_s}
27
27
  end
28
28
 
29
29
  test "around_perform hooks are found and sorted" do
30
- assert_equal ["around_perform", "around_perform1", "around_perform2"], Resque::Plugin.around_hooks(SimplePlugin)
30
+ assert_equal ["around_perform", "around_perform1", "around_perform2"], Resque::Plugin.around_hooks(SimplePlugin).map {|m| m.to_s}
31
31
  end
32
32
 
33
33
  test "on_failure hooks are found and sorted" do
34
- assert_equal ["on_failure", "on_failure1", "on_failure2"], Resque::Plugin.failure_hooks(SimplePlugin)
34
+ assert_equal ["on_failure", "on_failure1", "on_failure2"], Resque::Plugin.failure_hooks(SimplePlugin).map {|m| m.to_s}
35
35
  end
36
36
  end
37
37
 
38
38
  context "Resque::Plugin linting" do
39
- module BadBefore
39
+ module ::BadBefore
40
40
  def self.before_perform; end
41
41
  end
42
- module BadAfter
42
+ module ::BadAfter
43
43
  def self.after_perform; end
44
44
  end
45
- module BadAround
45
+ module ::BadAround
46
46
  def self.around_perform; end
47
47
  end
48
- module BadFailure
48
+ module ::BadFailure
49
49
  def self.on_failure; end
50
50
  end
51
51
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 9
8
- - 5
9
- version: 1.9.5
8
+ - 7
9
+ version: 1.9.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Chris Wanstrath
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-16 00:00:00 +02:00
17
+ date: 2010-07-09 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -26,9 +26,9 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
28
  - 0
29
- - 5
29
+ - 7
30
30
  - 0
31
- version: 0.5.0
31
+ version: 0.7.0
32
32
  type: :runtime
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency