resque 1.23.1 → 1.24.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,5 +1,41 @@
1
- ## 1.24.0.pre (YYYY-MM-DD)
2
-
1
+ ## unreleased
2
+
3
+ * No changes.
4
+
5
+ ## 1.24.0 (2013-3-21)
6
+
7
+ * Web UI: Fix regression that caused the failure tab to break when using
8
+ certain failure backends (@kjg)
9
+ * Web UI: Add page list to queues (@ql)
10
+ * Web UI: Fix regression that caused the failure tab to break when clicking on
11
+ "clear all failures" under certain failure backends, #859 (@jonhyman)
12
+ * Fix regression for Resque hooks where Resque would error out if you assigned
13
+ multiple hooks using an array, #859 (@jonhyman)
14
+ * Adds ENV["RUN_AT_EXIT_HOOKS"] which when set to 1 causes any defined
15
+ `at_exit` hooks to be run on the child when the forked process exits, #862
16
+ (@jonhyman)
17
+ * Bump up redis-namespace to 1.2.
18
+ * Remove multi_json, the JSON gem does the right thing everywhere now.
19
+ * Documentation fixes with demo instructions.
20
+ * Fixed encoding for worker PIDs on Windows (@kzgs)
21
+ * Cache value of PID in an ivar. This way, if you try to look up worker PIDs
22
+ from some other process (such as the console), they will be correct.
23
+ * Add a mutex-free logger. Ruby 2.0 does not allow you to use a mutex from
24
+ a signal handler, which can potentially cause deadlock. Now we're using
25
+ `mono_logger`, which has no locks.
26
+
27
+ ## 1.23.1 (2013-3-7)
28
+
29
+ * JRuby and Rubinius are 'allow failure' on CI. This is largely due to Travis
30
+ weridness and flaky tests.
31
+ * Fix link from "queues" view to "failed" view when there's only one failed
32
+ queue (trliner)
33
+ * Making all the failure backends have the same method signature for duck
34
+ typing purposes (jonhyman)
35
+ * Fix log formatters not appending a new line (flavorpill)
36
+ * redirect unauthorized resque-web polling requests to root url (trliner)
37
+ * Disable forking with FORK_PER_JOB=false (@tarcieri)
38
+ * Various resque-web fixes (@tarcieri)
3
39
  * Optional RedisMultiQueue failure backend, can be enabled with
4
40
  FAILURE_BACKEND=redis_multi_queue env var (@tarcieri)
5
41
  * resque:failures:sort rake task will migrate an existing "failed" queue into
@@ -7,6 +43,7 @@
7
43
  the RedisMultiQueue failure backend (@tarcieri)
8
44
  * Disable forking completely with FORK_PER_JOB=false env var (@tarcieri)
9
45
  * Report a failure when processes are killed with signals (@dylanahsmith)
46
+ * Enable registering of multiple Resque hooks (@panthomakos, @jonhyman)
10
47
 
11
48
  ## 1.23.0 (2012-10-01)
12
49
 
@@ -1,4 +1,4 @@
1
- require 'logger'
1
+ require 'mono_logger'
2
2
  require 'redis/namespace'
3
3
 
4
4
  require 'resque/version'
@@ -387,7 +387,7 @@ module Resque
387
387
  :queues => queues.size,
388
388
  :workers => workers.size.to_i,
389
389
  :working => working.size,
390
- :failed => Stat[:failed],
390
+ :failed => Resque.redis.llen(:failed).to_i,
391
391
  :servers => [redis_id],
392
392
  :environment => ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
393
393
  }
@@ -412,7 +412,9 @@ module Resque
412
412
 
413
413
  @hooks ||= {}
414
414
  @hooks[name] ||= []
415
- @hooks[name] << block
415
+
416
+ block = Array(block)
417
+ @hooks[name].concat(block)
416
418
  end
417
419
 
418
420
  # Clear all hooks given a hook name.
@@ -427,5 +429,5 @@ module Resque
427
429
  end
428
430
 
429
431
  # Log to STDOUT by default
430
- Resque.logger = Logger.new(STDOUT)
432
+ Resque.logger = MonoLogger.new(STDOUT)
431
433
  Resque.logger.formatter = Resque::QuietFormatter.new
@@ -47,7 +47,7 @@ module Resque
47
47
  end
48
48
 
49
49
  # Iterate across failed objects
50
- def self.each(offset = 0, limit = self.count)
50
+ def self.each(*args)
51
51
  end
52
52
 
53
53
  # A URL where someone can go to view failures.
@@ -55,7 +55,7 @@ module Resque
55
55
  end
56
56
 
57
57
  # Clear all failure objects
58
- def self.clear
58
+ def self.clear(*args)
59
59
  end
60
60
 
61
61
  def self.requeue(index)
@@ -23,13 +23,18 @@ module Resque
23
23
  end
24
24
 
25
25
  # The number of failures.
26
- def self.count(queue = nil, class_name = nil)
27
- classes.first.count(queue, class_name)
26
+ def self.count(*args)
27
+ classes.first.count(*args)
28
28
  end
29
29
 
30
30
  # Returns a paginated array of failure objects.
31
- def self.all(start = 0, count = 1)
32
- classes.first.all(start,count)
31
+ def self.all(*args)
32
+ classes.first.all(*args)
33
+ end
34
+
35
+ # Iterate across failed objects
36
+ def self.each(*args, &block)
37
+ classes.first.each(*args, &block)
33
38
  end
34
39
 
35
40
  # A URL where someone can go to view failures.
@@ -38,8 +43,8 @@ module Resque
38
43
  end
39
44
 
40
45
  # Clear all failure objects
41
- def self.clear
42
- classes.first.clear
46
+ def self.clear(*args)
47
+ classes.first.clear(*args)
43
48
  end
44
49
 
45
50
  def self.requeue(*args)
@@ -78,7 +78,7 @@ body { padding:0; margin:0; }
78
78
  #main ul.failed li dl dd.error a {font-family:Monaco, "Courier New", monospace; font-size:90%; }
79
79
  #main ul.failed li dl dd.error pre { margin-top:3px; line-height:1.3;}
80
80
 
81
- #main p.pagination { background:#efefef; padding:10px; overflow:hidden;}
81
+ #main p.pagination { background:#efefef; padding:10px; overflow:hidden; text-align:center}
82
82
  #main p.pagination a.less { float:left;}
83
83
  #main p.pagination a.more { float:right;}
84
84
 
@@ -24,5 +24,5 @@
24
24
  <% end %>
25
25
  </ul>
26
26
 
27
- <%= partial :next_more, :start => failed_start_at, :size => failed_size unless params[:class] %>
27
+ <%= partial :next_more, :start => failed_start_at, :size => failed_size, :per_page => failed_per_page %>
28
28
  <% end %>
@@ -15,5 +15,5 @@
15
15
  <% end %>
16
16
  </table>
17
17
 
18
- <%= partial :next_more, :start => start, :size => size %>
18
+ <%= partial :next_more, :start => start, :size => size, :per_page => 20 %>
19
19
  <% end %>
@@ -1,10 +1,19 @@
1
- <%if start - 20 >= 0 || start + 20 <= size%>
1
+ <%if start - per_page >= 0 || start + per_page <= size%>
2
2
  <p class='pagination'>
3
- <% if start - 20 >= 0 %>
4
- <a href="<%= current_page %>?start=<%= start - 20 %>" class='less'>&laquo; less</a>
3
+ <% if start - per_page >= 0 %>
4
+ <a href="<%= current_page %>?start=<%= start - per_page %>" class='less'>&laquo; Previous</a>
5
5
  <% end %>
6
- <% if start + 20 <= size %>
7
- <a href="<%= current_page %>?start=<%= start + 20 %>" class='more'>more &raquo;</a>
6
+
7
+ <% (0...(size / per_page.to_f).ceil).each do |page_num| %>
8
+ <% if start == page_num * per_page %>
9
+ <%= page_num + 1 %>
10
+ <% else %>
11
+ <a href="<%= current_page %>?start=<%= page_num * per_page %>"> <%= page_num + 1 %></a>
12
+ <% end %>
13
+ <% end %>
14
+
15
+ <% if start + per_page <= size %>
16
+ <a href="<%= current_page %>?start=<%= start + per_page %>" class='more'>Next &raquo;</a>
8
17
  <% end %>
9
18
  </p>
10
- <%end%>
19
+ <%end%>
@@ -24,7 +24,7 @@
24
24
  </tr>
25
25
  <% end %>
26
26
  </table>
27
- <%= partial :next_more, :start => start, :size => size %>
27
+ <%= partial :next_more, :start => start, :size => size, :per_page => 20 %>
28
28
  <% else %>
29
29
 
30
30
  <h1 class='wi'>Queues</h1>
@@ -20,6 +20,7 @@ namespace :resque do
20
20
  end
21
21
  worker.term_timeout = ENV['RESQUE_TERM_TIMEOUT'] || 4.0
22
22
  worker.term_child = ENV['TERM_CHILD']
23
+ worker.run_at_exit_hooks = ENV['RUN_AT_EXIT_HOOKS']
23
24
  rescue Resque::NoQueueError
24
25
  abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
25
26
  end
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.23.1'
2
+ Version = VERSION = '1.24.0'
3
3
  end
@@ -20,6 +20,10 @@ module Resque
20
20
  # decide whether to use new_kill_child logic
21
21
  attr_accessor :term_child
22
22
 
23
+ # When set to true, forked workers will exit with `exit`, calling any `at_exit` code handlers that have been
24
+ # registered in the application. Otherwise, forked workers exit with `exit!`
25
+ attr_accessor :run_at_exit_hooks
26
+
23
27
  attr_writer :to_s
24
28
 
25
29
  # Returns an array of all worker objects.
@@ -133,7 +137,14 @@ module Resque
133
137
  job.worker = self
134
138
  working_on job
135
139
 
136
- if @child = fork(job)
140
+ procline "Processing #{job.queue} since #{Time.now.to_i} [#{job.payload_class}]"
141
+ if @child = fork(job) do
142
+ unregister_signal_handlers if term_child
143
+ reconnect
144
+ perform(job, &block)
145
+ exit! unless run_at_exit_hooks
146
+ end
147
+
137
148
  srand # Reseeding
138
149
  procline "Forked #{@child} at #{Time.now.to_i}"
139
150
  begin
@@ -143,13 +154,9 @@ module Resque
143
154
  end
144
155
  job.fail(DirtyExit.new($?.to_s)) if $?.signaled?
145
156
  else
146
- unregister_signal_handlers if will_fork? && term_child
147
- procline "Processing #{job.queue} since #{Time.now.to_i} [#{job.payload_class}]"
148
157
  reconnect
149
158
  perform(job, &block)
150
- exit!(true) if will_fork?
151
159
  end
152
-
153
160
  done_working
154
161
  @child = nil
155
162
  else
@@ -216,7 +223,7 @@ module Resque
216
223
  log e.backtrace.join("\n")
217
224
  raise e
218
225
  end
219
-
226
+
220
227
  # Reconnect to Redis to avoid sharing a connection with the parent,
221
228
  # retry up to 3 times with increasing delay before giving up.
222
229
  def reconnect
@@ -244,9 +251,9 @@ module Resque
244
251
 
245
252
  # Not every platform supports fork. Here we do our magic to
246
253
  # determine if yours does.
247
- def fork(job)
254
+ def fork(job,&block)
248
255
  return if @cant_fork
249
-
256
+
250
257
  # Only run before_fork hooks if we're actually going to fork
251
258
  # (after checking @cant_fork)
252
259
  run_hook :before_fork, job
@@ -254,7 +261,7 @@ module Resque
254
261
  begin
255
262
  # IronRuby doesn't support `Kernel.fork` yet
256
263
  if Kernel.respond_to?(:fork)
257
- Kernel.fork if will_fork?
264
+ Kernel.fork &block if will_fork?
258
265
  else
259
266
  raise NotImplementedError
260
267
  end
@@ -266,7 +273,7 @@ module Resque
266
273
 
267
274
  # Runs all the methods needed when a worker begins its lifecycle.
268
275
  def startup
269
- Kernel.warn "WARNING: This way of doing signal handling is now deprecated. Please see http://hone.heroku.com/resque/2012/08/21/resque-signals.html for more info." unless term_child
276
+ Kernel.warn "WARNING: This way of doing signal handling is now deprecated. Please see http://hone.heroku.com/resque/2012/08/21/resque-signals.html for more info." unless term_child or $TESTING
270
277
  enable_gc_optimizations
271
278
  register_signal_handlers
272
279
  prune_dead_workers
@@ -353,7 +360,7 @@ module Resque
353
360
  def kill_child
354
361
  if @child
355
362
  log! "Killing child at #{@child}"
356
- if system("ps -o pid,state -p #{@child}")
363
+ if `ps -o pid,state -p #{@child}`
357
364
  Process.kill("KILL", @child) rescue nil
358
365
  else
359
366
  log! "Child #{@child} not found, restarting."
@@ -550,7 +557,7 @@ module Resque
550
557
  # The string representation is the same as the id for this worker
551
558
  # instance. Can be used with `Worker.find`.
552
559
  def to_s
553
- @to_s ||= "#{hostname}:#{Process.pid}:#{@queues.join(',')}"
560
+ @to_s ||= "#{hostname}:#{pid}:#{@queues.join(',')}"
554
561
  end
555
562
  alias_method :id, :to_s
556
563
 
@@ -561,7 +568,7 @@ module Resque
561
568
 
562
569
  # Returns Integer PID of running worker
563
570
  def pid
564
- Process.pid
571
+ @pid ||= Process.pid
565
572
  end
566
573
 
567
574
  # Returns an Array of string pids of all the other workers on this
@@ -574,10 +581,15 @@ module Resque
574
581
  end
575
582
  end
576
583
 
577
- # Find Resque worker pids on Linux and OS X.
578
- #
579
584
  # Returns an Array of string pids of all the other workers on this
580
585
  # machine. Useful when pruning dead workers on startup.
586
+ def windows_worker_pids
587
+ tasklist_output = `tasklist /FI "IMAGENAME eq ruby.exe" /FO list`.encode("UTF-8", Encoding.locale_charmap)
588
+ tasklist_output.split($/).select { |line| line =~ /^PID:/}.collect{ |line| line.gsub /PID:\s+/, '' }
589
+ end
590
+
591
+ # Find Resque worker pids on Linux and OS X.
592
+ #
581
593
  def linux_worker_pids
582
594
  `ps -A -o pid,command | grep "[r]esque" | grep -v "resque-web"`.split("\n").map do |line|
583
595
  line.split(' ')[0]
@@ -657,6 +669,7 @@ module Resque
657
669
  end
658
670
 
659
671
  def logger_severity_deprecation_warning
672
+ return if $TESTING
660
673
  return if $warned_logger_severity_deprecation
661
674
  Kernel.warn "*** DEPRECATION WARNING: Resque::Worker#verbose and #very_verbose are deprecated. Please set Resque.logger.level instead"
662
675
  Kernel.warn "Called from: #{caller[0..5].join("\n\t")}"
Binary file
@@ -49,6 +49,7 @@ describe "Resque Hooks" do
49
49
  end
50
50
 
51
51
  it 'it calls after_fork after each job' do
52
+ skip("TRAAAVIS!!!!") if RUBY_VERSION == "1.8.7"
52
53
  # We have to stub out will_fork? to return true, which is going to cause an actual fork(). As such, the
53
54
  # exit!(true) will be called in Worker#work; to share state, use a tempfile
54
55
  file = Tempfile.new("resque_after_fork")
@@ -119,6 +120,17 @@ describe "Resque Hooks" do
119
120
  assert(first && second)
120
121
  end
121
122
 
123
+ it 'flattens hooks on assignment' do
124
+ first = false
125
+ second = false
126
+ Resque.before_fork = [Proc.new { first = true }, Proc.new { second = true }]
127
+ Resque::Job.create(:jobs, CallNotifyJob)
128
+
129
+ assert(!first && !second)
130
+ @worker.work(0)
131
+ assert(first && second)
132
+ end
133
+
122
134
  it 'it registers multiple after_forks' do
123
135
  # We have to stub out will_fork? to return true, which is going to cause an actual fork(). As such, the
124
136
  # exit!(true) will be called in Worker#work; to share state, use a tempfile
@@ -2,12 +2,13 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'minitest/autorun'
4
4
  require 'redis/namespace'
5
- require 'mocha'
5
+ require 'mocha/setup'
6
6
 
7
7
  $dir = File.dirname(File.expand_path(__FILE__))
8
8
  $LOAD_PATH.unshift $dir + '/../lib'
9
9
  require 'resque'
10
10
  $TESTING = true
11
+ $TEST_PID=Process.pid
11
12
 
12
13
  begin
13
14
  require 'leftright'
@@ -32,11 +33,13 @@ end
32
33
  #
33
34
 
34
35
  MiniTest::Unit.after_tests do
35
- processes = `ps -A -o pid,command | grep [r]edis-test`.split("\n")
36
- pids = processes.map { |process| process.split(" ")[0] }
37
- puts "Killing test redis server..."
38
- pids.each { |pid| Process.kill("TERM", pid.to_i) }
39
- system("rm -f #{$dir}/dump.rdb #{$dir}/dump-cluster.rdb")
36
+ if Process.pid == $TEST_PID
37
+ processes = `ps -A -o pid,command | grep [r]edis-test`.split("\n")
38
+ pids = processes.map { |process| process.split(" ")[0] }
39
+ puts "Killing test redis server..."
40
+ pids.each { |pid| Process.kill("TERM", pid.to_i) }
41
+ system("rm -f #{$dir}/dump.rdb #{$dir}/dump-cluster.rdb")
42
+ end
40
43
  end
41
44
 
42
45
  if ENV.key? 'RESQUE_DISTRIBUTED'
@@ -116,6 +119,15 @@ class GoodJob
116
119
  end
117
120
  end
118
121
 
122
+ class AtExitJob
123
+ def self.perform(filename)
124
+ at_exit do
125
+ File.open(filename, "w") {|file| file.puts "at_exit"}
126
+ end
127
+ "at_exit job"
128
+ end
129
+ end
130
+
119
131
  class BadJobWithSyntaxError
120
132
  def self.perform
121
133
  raise SyntaxError, "Extra Bad job!"
@@ -171,8 +183,15 @@ end
171
183
 
172
184
  # Log to log/test.log
173
185
  def reset_logger
174
- $test_logger ||= Logger.new(File.open(File.expand_path("../../log/test.log", __FILE__), "w"))
186
+ $test_logger ||= MonoLogger.new(File.open(File.expand_path("../../log/test.log", __FILE__), "w"))
175
187
  Resque.logger = $test_logger
176
188
  end
177
189
 
178
190
  reset_logger
191
+
192
+ def suppress_warnings
193
+ old_verbose, $VERBOSE = $VERBOSE, nil
194
+ yield
195
+ ensure
196
+ $VERBOSE = old_verbose
197
+ end
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'tmpdir'
2
3
 
3
4
  context "Resque::Worker" do
4
5
  setup do
@@ -31,7 +32,67 @@ context "Resque::Worker" do
31
32
  @worker.perform job
32
33
  end
33
34
  end
34
-
35
+
36
+ test "does not raise exception for completed jobs" do
37
+ if worker_pid = Kernel.fork
38
+ Process.waitpid(worker_pid)
39
+ assert_equal 0, Resque::Failure.count
40
+ else
41
+ # ensure we actually fork
42
+ $TESTING = false
43
+ Resque.redis.client.reconnect
44
+ worker = Resque::Worker.new(:jobs)
45
+ suppress_warnings do
46
+ worker.work(0)
47
+ end
48
+ exit
49
+ end
50
+ end
51
+
52
+ test "executes at_exit hooks when configured with run_at_exit_hooks" do
53
+ tmpfile = File.join(Dir.tmpdir, "resque_at_exit_test_file")
54
+ FileUtils.rm_f tmpfile
55
+
56
+ if worker_pid = Kernel.fork
57
+ Process.waitpid(worker_pid)
58
+ assert File.exist?(tmpfile), "The file '#{tmpfile}' does not exist"
59
+ assert_equal "at_exit", File.open(tmpfile).read.strip
60
+ else
61
+ # ensure we actually fork
62
+ $TESTING = false
63
+ Resque.redis.client.reconnect
64
+ Resque::Job.create(:at_exit_jobs, AtExitJob, tmpfile)
65
+ worker = Resque::Worker.new(:at_exit_jobs)
66
+ worker.run_at_exit_hooks = true
67
+ suppress_warnings do
68
+ worker.work(0)
69
+ end
70
+ exit
71
+ end
72
+
73
+ end
74
+
75
+ test "does not execute at_exit hooks by default" do
76
+ tmpfile = File.join(Dir.tmpdir, "resque_at_exit_test_file")
77
+ FileUtils.rm_f tmpfile
78
+
79
+ if worker_pid = Kernel.fork
80
+ Process.waitpid(worker_pid)
81
+ assert !File.exist?(tmpfile), "The file '#{tmpfile}' exists, at_exit hooks were run"
82
+ else
83
+ # ensure we actually fork
84
+ $TESTING = false
85
+ Resque.redis.client.reconnect
86
+ Resque::Job.create(:at_exit_jobs, AtExitJob, tmpfile)
87
+ worker = Resque::Worker.new(:at_exit_jobs)
88
+ suppress_warnings do
89
+ worker.work(0)
90
+ end
91
+ exit
92
+ end
93
+
94
+ end
95
+
35
96
  test "register 'run_at' time on UTC timezone in ISO8601 format" do
36
97
  job = Resque::Job.new(:jobs, {'class' => 'GoodJob', 'args' => "blah"})
37
98
  now = Time.now.utc.iso8601
@@ -558,6 +619,44 @@ context "Resque::Worker" do
558
619
  end
559
620
 
560
621
  test "tries to reconnect three times before giving up" do
622
+ begin
623
+ class Redis::Client
624
+ alias_method :original_reconnect, :reconnect
625
+
626
+ def reconnect
627
+ raise Redis::BaseConnectionError
628
+ end
629
+ end
630
+
631
+ class Resque::Worker
632
+ alias_method :original_sleep, :sleep
633
+
634
+ def sleep(duration = nil)
635
+ # noop
636
+ end
637
+ end
638
+
639
+ stdout, stderr = capture_io do
640
+ Resque.logger = Logger.new($stdout)
641
+ @worker.work(0)
642
+ end
643
+
644
+ assert_equal 3, stdout.scan(/retrying/).count
645
+ assert_equal 1, stdout.scan(/quitting/).count
646
+ ensure
647
+ class Redis::Client
648
+ alias_method :reconnect, :original_reconnect
649
+ end
650
+
651
+ class Resque::Worker
652
+ alias_method :sleep, :original_sleep
653
+ end
654
+ end
655
+ end
656
+
657
+ test "will call before_pause before it is paused" do
658
+ before_pause_called = false
659
+ captured_worker = nil
561
660
  begin
562
661
  class Redis::Client
563
662
  alias_method :original_reconnect, :reconnect
@@ -642,7 +741,9 @@ context "Resque::Worker" do
642
741
 
643
742
  worker = Resque::Worker.new(:long_running_job)
644
743
 
645
- worker.work(0)
744
+ suppress_warnings do
745
+ worker.work(0)
746
+ end
646
747
  exit!
647
748
  end
648
749
 
@@ -661,8 +762,8 @@ context "Resque::Worker" do
661
762
  assert_nil result
662
763
 
663
764
  # ensure that the child pid is no longer running
664
- child_still_running = !(`ps -p #{child_pid.to_s} -o pid=`).empty?
665
- assert !child_still_running
765
+ child_not_running = `ps -p #{child_pid.to_s} -o pid=`.empty?
766
+ assert child_not_running
666
767
  ensure
667
768
  remaining_keys = Resque.redis.keys('sigterm-test:*') || []
668
769
  Resque.redis.del(*remaining_keys) unless remaining_keys.empty?
@@ -745,9 +846,14 @@ context "Resque::Worker" do
745
846
  end
746
847
 
747
848
  test "displays warning when not using term_child" do
748
- stdout, stderr = capture_io { @worker.work(0) }
849
+ begin
850
+ $TESTING = false
851
+ stdout, stderr = capture_io { @worker.work(0) }
749
852
 
750
- assert stderr.match(/^WARNING:/)
853
+ assert stderr.match(/^WARNING:/)
854
+ ensure
855
+ $TESTING = true
856
+ end
751
857
  end
752
858
 
753
859
  test "it does not display warning when using term_child" do
@@ -773,7 +879,9 @@ context "Resque::Worker" do
773
879
  begin
774
880
  $TESTING = false
775
881
  Resque.enqueue(SuicidalJob)
776
- @worker.work(0)
882
+ suppress_warnings do
883
+ @worker.work(0)
884
+ end
777
885
  assert_equal Resque::DirtyExit, SuicidalJob.send(:class_variable_get, :@@failure_exception).class
778
886
  ensure
779
887
  $TESTING = true
@@ -782,28 +890,48 @@ context "Resque::Worker" do
782
890
  end
783
891
 
784
892
  test "displays warning when using verbose" do
785
- stdout, stderr = capture_io { @worker.verbose }
893
+ begin
894
+ $TESTING = false
895
+ stdout, stderr = capture_io { @worker.verbose }
896
+ ensure
897
+ $TESTING = true
898
+ end
786
899
  $warned_logger_severity_deprecation = false
787
900
 
788
901
  assert stderr.match(/WARNING:/)
789
902
  end
790
903
 
791
904
  test "displays warning when using verbose=" do
792
- stdout, stderr = capture_io { @worker.verbose = true }
905
+ begin
906
+ $TESTING = false
907
+ stdout, stderr = capture_io { @worker.verbose = true }
908
+ ensure
909
+ $TESTING = true
910
+ end
793
911
  $warned_logger_severity_deprecation = false
794
912
 
795
913
  assert stderr.match(/WARNING:/)
796
914
  end
797
915
 
798
916
  test "displays warning when using very_verbose" do
799
- stdout, stderr = capture_io { @worker.very_verbose }
917
+ begin
918
+ $TESTING = false
919
+ stdout, stderr = capture_io { @worker.very_verbose }
920
+ ensure
921
+ $TESTING = true
922
+ end
800
923
  $warned_logger_severity_deprecation = false
801
924
 
802
925
  assert stderr.match(/WARNING:/)
803
926
  end
804
927
 
805
928
  test "displays warning when using very_verbose=" do
806
- stdout, stderr = capture_io { @worker.very_verbose = true }
929
+ begin
930
+ $TESTING = false
931
+ stdout, stderr = capture_io { @worker.very_verbose = true }
932
+ ensure
933
+ $TESTING = true
934
+ end
807
935
  $warned_logger_severity_deprecation = false
808
936
 
809
937
  assert stderr.match(/WARNING:/)
metadata CHANGED
@@ -1,90 +1,112 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: resque
3
- version: !ruby/object:Gem::Version
4
- version: 1.23.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 119
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 24
9
+ - 0
10
+ version: 1.24.0
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Chris Wanstrath
8
14
  - Terence Lee
9
15
  autorequire:
10
16
  bindir: bin
11
17
  cert_chain: []
12
- date: 2013-03-07 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
18
+
19
+ date: 2013-03-21 00:00:00 -04:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
15
23
  name: redis-namespace
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: '1.0'
21
- type: :runtime
22
24
  prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- version: '1.0'
28
- - !ruby/object:Gem::Dependency
29
- name: vegas
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
32
28
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: 0.1.2
29
+ - !ruby/object:Gem::Version
30
+ hash: 11
31
+ segments:
32
+ - 1
33
+ - 2
34
+ version: "1.2"
35
35
  type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: vegas
36
39
  prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
39
43
  - - ~>
40
- - !ruby/object:Gem::Version
44
+ - !ruby/object:Gem::Version
45
+ hash: 31
46
+ segments:
47
+ - 0
48
+ - 1
49
+ - 2
41
50
  version: 0.1.2
42
- - !ruby/object:Gem::Dependency
43
- name: sinatra
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: 0.9.2
49
51
  type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: sinatra
50
55
  prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 63
62
+ segments:
63
+ - 0
64
+ - 9
65
+ - 2
55
66
  version: 0.9.2
56
- - !ruby/object:Gem::Dependency
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
57
70
  name: multi_json
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
60
75
  - - ~>
61
- - !ruby/object:Gem::Version
62
- version: '1.0'
76
+ - !ruby/object:Gem::Version
77
+ hash: 15
78
+ segments:
79
+ - 1
80
+ - 0
81
+ version: "1.0"
63
82
  type: :runtime
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: mono_logger
64
86
  prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
67
90
  - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '1.0'
70
- description: ! " Resque is a Redis-backed Ruby library for creating background
71
- jobs,\n placing those jobs on multiple queues, and processing them later.\n\n
72
- \ Background jobs can be any Ruby class or module that responds to\n perform.
73
- Your existing classes can easily be converted to background\n jobs or you can
74
- create new classes specifically to do work. Or, you\n can do both.\n\n Resque
75
- is heavily inspired by DelayedJob (which rocks) and is\n comprised of three parts:\n\n
76
- \ * A Ruby library for creating, querying, and processing jobs\n * A Rake task
77
- for starting a worker which processes jobs\n * A Sinatra app for monitoring queues,
78
- jobs, and workers.\n"
91
+ - !ruby/object:Gem::Version
92
+ hash: 15
93
+ segments:
94
+ - 1
95
+ - 0
96
+ version: "1.0"
97
+ type: :runtime
98
+ version_requirements: *id005
99
+ description: " Resque is a Redis-backed Ruby library for creating background jobs,\n placing those jobs on multiple queues, and processing them later.\n\n Background jobs can be any Ruby class or module that responds to\n perform. Your existing classes can easily be converted to background\n jobs or you can create new classes specifically to do work. Or, you\n can do both.\n\n Resque is heavily inspired by DelayedJob (which rocks) and is\n comprised of three parts:\n\n * A Ruby library for creating, querying, and processing jobs\n * A Rake task for starting a worker which processes jobs\n * A Sinatra app for monitoring queues, jobs, and workers.\n"
79
100
  email: chris@ozmm.org
80
- executables:
101
+ executables:
81
102
  - resque
82
103
  - resque-web
83
104
  extensions: []
84
- extra_rdoc_files:
105
+
106
+ extra_rdoc_files:
85
107
  - LICENSE
86
108
  - README.markdown
87
- files:
109
+ files:
88
110
  - README.markdown
89
111
  - Rakefile
90
112
  - LICENSE
@@ -157,28 +179,39 @@ files:
157
179
  - test/resque_test.rb
158
180
  - test/test_helper.rb
159
181
  - test/worker_test.rb
182
+ has_rdoc: true
160
183
  homepage: http://github.com/defunkt/resque
161
184
  licenses: []
162
- metadata: {}
185
+
163
186
  post_install_message:
164
- rdoc_options:
187
+ rdoc_options:
165
188
  - --charset=UTF-8
166
- require_paths:
189
+ require_paths:
167
190
  - lib
168
- required_ruby_version: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - ! '>='
171
- - !ruby/object:Gem::Version
172
- version: '0'
173
- required_rubygems_version: !ruby/object:Gem::Requirement
174
- requirements:
175
- - - ! '>='
176
- - !ruby/object:Gem::Version
177
- version: '0'
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
178
209
  requirements: []
210
+
179
211
  rubyforge_project:
180
- rubygems_version: 2.0.2
212
+ rubygems_version: 1.6.2
181
213
  signing_key:
182
- specification_version: 4
214
+ specification_version: 3
183
215
  summary: Resque is a Redis-backed queueing system.
184
216
  test_files: []
217
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7c520ddc0c19372cbe01b4b9a8748769aa251226
4
- data.tar.gz: 2ef08bafba6cd858a8110ba93e1d9c5d4815655a
5
- SHA512:
6
- metadata.gz: 7c3c1c8f7651ffb5b7cd22587c8d1f2854b42ab0665b3ce3bbdf00b106d54459036a8f808379228ca772bb492ea5572ec2f9498ecca6bb44d8e59d2da3cbf736
7
- data.tar.gz: c510d27db4fa8821b27b26a170dd87d7ccaf21f51b14df9e831e63b02cc194286eeeb55ff9447abb6cf964acbbf265e7bdfde651570c7fa86e46a5a2e7a4082a