resque 1.25.2 → 1.26.pre.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,14 +1,17 @@
1
- ## 1.25.2 (TBD)
2
-
3
- * Respect TERM_CHILD setting when not forking (@ggilder)
4
- * implementation of backend connection with a hash (Andrea Rossi)
5
- * require yaml for show_args support (@yaauie)
6
- * use redis-namespace 1.3 (Andrea Rossi)
7
- * fix DOCS link in README (@cade)
8
- * Fix worker prune test to actually run its assertion & cover reality. (@yaauie)
9
- * Eliminate infinite recursion when Resque::Helpers mixed into Resque (@yaml)
10
- * use ruby, avoid shelling out. google++ (@hone)
11
- * Failed Assertions Don't Fail Tests :rage: (@yaauie)
1
+ ## 1.26.0 (TBD)
2
+
3
+ * FIX: use Socket.hostname instead of shelling out in order to avoid
4
+ errors caused when too many workers are started simultaneously. #1152
5
+ Backport of fix from 2.x master. (@hone, @RunsFor)
6
+ * FIX: infinite recusion when applying a workaround to make resque
7
+ backwards-compatible with <= 1.24. #1150 (@yaauie)
8
+ * FIX: add/fix test coverage for worker pruning and be a little more
9
+ aggressive in what we prune. (@yaauie)
10
+ * FIX: require yaml library for show_args support in resque-web. #1143
11
+ (@yaauie)
12
+ * FIX: README and documentation link fixes. #1130 (@cade)
13
+ * Feature: implementation of Backend connection with Hash, using the same
14
+ connection hash supported by redis-rb #1140 (@lucidstack)
12
15
 
13
16
  ## 1.25.1 (2013-9-26)
14
17
 
@@ -20,7 +23,7 @@
20
23
  context (@jonhyman)
21
24
  * Use Redis.pipelined to group batches of redis commands.
22
25
  https://github.com/resque/resque/pull/902 (@jonhyman)
23
- * Fixed uninitialize constant for the module/class that contains the perform
26
+ * Fixed uninitialize constant for the module/class that contains the perform
24
27
  method causing job failures to no be reported, #792 (@sideshowcoder)
25
28
  * Fix Resque::Failure::Base.all to have the correct signature.
26
29
  (@rentalutions)
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.25.2'
2
+ Version = VERSION = '1.26.pre.0'
3
3
  end
@@ -410,19 +410,10 @@ module Resque
410
410
  end
411
411
 
412
412
  # Kill the child and shutdown immediately.
413
- # If not forking, abort this process.
414
413
  def shutdown!
415
414
  shutdown
416
415
  if term_child
417
- if fork_per_job?
418
- new_kill_child
419
- else
420
- # Raise TermException in the same process
421
- trap('TERM') do
422
- # ignore subsequent terms
423
- end
424
- raise TermException.new("SIGTERM")
425
- end
416
+ new_kill_child
426
417
  else
427
418
  kill_child
428
419
  end
@@ -629,11 +620,7 @@ module Resque
629
620
  end
630
621
 
631
622
  def will_fork?
632
- !@cant_fork && !$TESTING && fork_per_job?
633
- end
634
-
635
- def fork_per_job?
636
- ENV["FORK_PER_JOB"] != 'false'
623
+ !@cant_fork && !$TESTING && (ENV["FORK_PER_JOB"] != 'false')
637
624
  end
638
625
 
639
626
  # Returns a symbol representing the current worker state,
Binary file
@@ -283,7 +283,6 @@ context "Resque::Job before_enqueue" do
283
283
  end
284
284
 
285
285
  test "a before enqueue hook that returns false should prevent the job from getting queued" do
286
- Resque.remove_queue(:jobs)
287
286
  history = []
288
287
  @worker = Resque::Worker.new(:jobs)
289
288
  assert_nil Resque.enqueue(BeforeEnqueueJobAbort, history)
@@ -89,36 +89,6 @@ module PerformJob
89
89
  end
90
90
  end
91
91
 
92
- ##
93
- # Helper to make Minitest::Assertion exceptions work properly
94
- # in the block given to Resque::Worker#work.
95
- #
96
- module AssertInWorkBlock
97
- # if a block is given, ensure that it is run, and that any assertion
98
- # failures that occur inside it propagate up to the test.
99
- def work(*args, &block)
100
- return super unless block_given?
101
-
102
- ex = catch(:exception_in_block) do
103
- block_called = nil
104
- retval = super(*args) do |*bargs|
105
- begin
106
- block_called = true
107
- block.call(*bargs)
108
- rescue MiniTest::Assertion => ex
109
- throw :exception_in_block, ex
110
- end
111
- end
112
-
113
- raise "assertion block not called!" unless block_called
114
-
115
- return retval
116
- end
117
-
118
- ex && raise(ex)
119
- end
120
- end
121
-
122
92
  #
123
93
  # fixture classes
124
94
  #
@@ -331,13 +331,13 @@ context "Resque::Worker" do
331
331
  end
332
332
 
333
333
  test "inserts itself into the 'workers' list on startup" do
334
- @worker.extend(AssertInWorkBlock).work(0) do
334
+ @worker.work(0) do
335
335
  assert_equal @worker, Resque.workers[0]
336
336
  end
337
337
  end
338
338
 
339
339
  test "removes itself from the 'workers' list on shutdown" do
340
- @worker.extend(AssertInWorkBlock).work(0) do
340
+ @worker.work(0) do
341
341
  assert_equal @worker, Resque.workers[0]
342
342
  end
343
343
 
@@ -345,7 +345,7 @@ context "Resque::Worker" do
345
345
  end
346
346
 
347
347
  test "removes worker with stringified id" do
348
- @worker.extend(AssertInWorkBlock).work(0) do
348
+ @worker.work(0) do
349
349
  worker_id = Resque.workers[0].to_s
350
350
  Resque.remove_worker(worker_id)
351
351
  assert_equal [], Resque.workers
@@ -353,7 +353,7 @@ context "Resque::Worker" do
353
353
  end
354
354
 
355
355
  test "records what it is working on" do
356
- @worker.extend(AssertInWorkBlock).work(0) do
356
+ @worker.work(0) do
357
357
  task = @worker.job
358
358
  assert_equal({"args"=>[20, "/tmp"], "class"=>"SomeJob"}, task['payload'])
359
359
  assert task['run_at']
@@ -367,7 +367,7 @@ context "Resque::Worker" do
367
367
  end
368
368
 
369
369
  test "knows when it is working" do
370
- @worker.extend(AssertInWorkBlock).work(0) do
370
+ @worker.work(0) do
371
371
  assert @worker.working?
372
372
  end
373
373
  end
@@ -378,7 +378,7 @@ context "Resque::Worker" do
378
378
  end
379
379
 
380
380
  test "knows who is working" do
381
- @worker.extend(AssertInWorkBlock).work(0) do
381
+ @worker.work(0) do
382
382
  assert_equal [@worker], Resque.working
383
383
  end
384
384
  end
@@ -413,27 +413,27 @@ context "Resque::Worker" do
413
413
 
414
414
  test "knows when it started" do
415
415
  time = Time.now
416
- @worker.extend(AssertInWorkBlock).work(0) do
416
+ @worker.work(0) do
417
417
  assert Time.parse(@worker.started) - time < 0.1
418
418
  end
419
419
  end
420
420
 
421
421
  test "knows whether it exists or not" do
422
- @worker.extend(AssertInWorkBlock).work(0) do
422
+ @worker.work(0) do
423
423
  assert Resque::Worker.exists?(@worker)
424
424
  assert !Resque::Worker.exists?('blah-blah')
425
425
  end
426
426
  end
427
427
 
428
428
  test "sets $0 while working" do
429
- @worker.extend(AssertInWorkBlock).work(0) do
429
+ @worker.work(0) do
430
430
  ver = Resque::Version
431
- assert_equal "resque-#{ver}: Processing jobs since #{Time.now.to_i} [SomeJob]", $0
431
+ assert_equal "resque-#{ver}: Processing jobs since #{Time.now.to_i}", $0
432
432
  end
433
433
  end
434
434
 
435
435
  test "can be found" do
436
- @worker.extend(AssertInWorkBlock).work(0) do
436
+ @worker.work(0) do
437
437
  found = Resque::Worker.find(@worker.to_s)
438
438
  assert_equal @worker.to_s, found.to_s
439
439
  assert found.working?
@@ -442,7 +442,7 @@ context "Resque::Worker" do
442
442
  end
443
443
 
444
444
  test "doesn't find fakes" do
445
- @worker.extend(AssertInWorkBlock).work(0) do
445
+ @worker.work(0) do
446
446
  found = Resque::Worker.find('blah-blah')
447
447
  assert_equal nil, found
448
448
  end
@@ -921,71 +921,6 @@ context "Resque::Worker" do
921
921
  end
922
922
  end
923
923
 
924
- test "exits with Resque::TermException when using TERM_CHILD and not forking" do
925
- begin
926
- class LongRunningJob
927
- @queue = :long_running_job
928
-
929
- def self.perform(run_time)
930
- Resque.redis.client.reconnect # get its own connection
931
- Resque.redis.rpush('term-exception-test:start', Process.pid)
932
- sleep run_time
933
- Resque.redis.rpush('term-exception-test:result', 'Finished Normally')
934
- rescue Resque::TermException => e
935
- Resque.redis.rpush('term-exception-test:result', %Q(Caught TermException: #{e.inspect}))
936
- ensure
937
- Resque.redis.rpush('term-exception-test:final', 'exiting.')
938
- end
939
- end
940
-
941
- Resque.enqueue(LongRunningJob, 5)
942
-
943
- worker_pid = Kernel.fork do
944
- # reconnect to redis
945
- Resque.redis.client.reconnect
946
-
947
- # ensure we don't fork (in worker)
948
- $TESTING = false
949
- ENV['FORK_PER_JOB'] = 'false'
950
-
951
- worker = Resque::Worker.new(:long_running_job)
952
- worker.term_timeout = 1
953
- worker.term_child = 1
954
-
955
- worker.work(0)
956
- exit!
957
- end
958
-
959
- # ensure the worker is started
960
- start_status = Resque.redis.blpop('term-exception-test:start', 5)
961
- assert_not_nil start_status
962
- child_pid = start_status[1].to_i
963
- assert_operator child_pid, :>, 0
964
-
965
- # send signal to abort the worker
966
- Process.kill('TERM', worker_pid)
967
- Process.waitpid(worker_pid)
968
-
969
- # wait to see how it all came down
970
- result = Resque.redis.blpop('term-exception-test:result', 5)
971
- assert_not_nil result
972
- assert !result[1].start_with?('Finished Normally'), 'Job finished normally. Sleep not long enough?'
973
- assert result[1].start_with?('Caught TermException'), 'TermException not raised in child.'
974
-
975
- # ensure that the child pid is no longer running
976
- child_still_running = !(`ps -p #{child_pid.to_s} -o pid=`).empty?
977
- assert !child_still_running
978
-
979
- # see if post-cleanup occurred.
980
- post_cleanup_occurred = Resque.redis.lpop( 'term-exception-test:final' )
981
- assert post_cleanup_occurred, 'post cleanup did not occur. SIGKILL sent too early?'
982
-
983
- ensure
984
- remaining_keys = Resque.redis.keys('term-exception-test:*') || []
985
- Resque.redis.del(*remaining_keys) unless remaining_keys.empty?
986
- end
987
- end
988
-
989
924
  test "displays warning when not using term_child" do
990
925
  begin
991
926
  $TESTING = false
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.25.2
4
+ version: 1.26.pre.0
5
+ prerelease: 5
5
6
  platform: ruby
6
7
  authors:
7
8
  - Chris Wanstrath
@@ -10,25 +11,28 @@ authors:
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2014-03-04 00:00:00.000000000 Z
14
+ date: 2013-12-06 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: redis-namespace
17
18
  requirement: !ruby/object:Gem::Requirement
19
+ none: false
18
20
  requirements:
19
21
  - - ~>
20
22
  - !ruby/object:Gem::Version
21
- version: '1.3'
23
+ version: '1.2'
22
24
  type: :runtime
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
25
28
  requirements:
26
29
  - - ~>
27
30
  - !ruby/object:Gem::Version
28
- version: '1.3'
31
+ version: '1.2'
29
32
  - !ruby/object:Gem::Dependency
30
33
  name: vegas
31
34
  requirement: !ruby/object:Gem::Requirement
35
+ none: false
32
36
  requirements:
33
37
  - - ~>
34
38
  - !ruby/object:Gem::Version
@@ -36,6 +40,7 @@ dependencies:
36
40
  type: :runtime
37
41
  prerelease: false
38
42
  version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
39
44
  requirements:
40
45
  - - ~>
41
46
  - !ruby/object:Gem::Version
@@ -43,20 +48,23 @@ dependencies:
43
48
  - !ruby/object:Gem::Dependency
44
49
  name: sinatra
45
50
  requirement: !ruby/object:Gem::Requirement
51
+ none: false
46
52
  requirements:
47
- - - '>='
53
+ - - ! '>='
48
54
  - !ruby/object:Gem::Version
49
55
  version: 0.9.2
50
56
  type: :runtime
51
57
  prerelease: false
52
58
  version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
53
60
  requirements:
54
- - - '>='
61
+ - - ! '>='
55
62
  - !ruby/object:Gem::Version
56
63
  version: 0.9.2
57
64
  - !ruby/object:Gem::Dependency
58
65
  name: multi_json
59
66
  requirement: !ruby/object:Gem::Requirement
67
+ none: false
60
68
  requirements:
61
69
  - - ~>
62
70
  - !ruby/object:Gem::Version
@@ -64,6 +72,7 @@ dependencies:
64
72
  type: :runtime
65
73
  prerelease: false
66
74
  version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
67
76
  requirements:
68
77
  - - ~>
69
78
  - !ruby/object:Gem::Version
@@ -71,6 +80,7 @@ dependencies:
71
80
  - !ruby/object:Gem::Dependency
72
81
  name: mono_logger
73
82
  requirement: !ruby/object:Gem::Requirement
83
+ none: false
74
84
  requirements:
75
85
  - - ~>
76
86
  - !ruby/object:Gem::Version
@@ -78,25 +88,20 @@ dependencies:
78
88
  type: :runtime
79
89
  prerelease: false
80
90
  version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
81
92
  requirements:
82
93
  - - ~>
83
94
  - !ruby/object:Gem::Version
84
95
  version: '1.0'
85
- description: |2
86
- Resque is a Redis-backed Ruby library for creating background jobs,
87
- placing those jobs on multiple queues, and processing them later.
88
-
89
- Background jobs can be any Ruby class or module that responds to
90
- perform. Your existing classes can easily be converted to background
91
- jobs or you can create new classes specifically to do work. Or, you
92
- can do both.
93
-
94
- Resque is heavily inspired by DelayedJob (which rocks) and is
95
- comprised of three parts:
96
-
97
- * A Ruby library for creating, querying, and processing jobs
98
- * A Rake task for starting a worker which processes jobs
99
- * A Sinatra app for monitoring queues, jobs, and workers.
96
+ description: ! " Resque is a Redis-backed Ruby library for creating background
97
+ jobs,\n placing those jobs on multiple queues, and processing them later.\n\n
98
+ \ Background jobs can be any Ruby class or module that responds to\n perform.
99
+ Your existing classes can easily be converted to background\n jobs or you can
100
+ create new classes specifically to do work. Or, you\n can do both.\n\n Resque
101
+ is heavily inspired by DelayedJob (which rocks) and is\n comprised of three parts:\n\n
102
+ \ * A Ruby library for creating, querying, and processing jobs\n * A Rake task
103
+ for starting a worker which processes jobs\n * A Sinatra app for monitoring queues,
104
+ jobs, and workers.\n"
100
105
  email: chris@ozmm.org
101
106
  executables:
102
107
  - resque
@@ -110,94 +115,96 @@ files:
110
115
  - Rakefile
111
116
  - LICENSE
112
117
  - HISTORY.md
113
- - lib/resque.rb
114
- - lib/tasks/resque.rake
115
- - lib/tasks/redis.rake
116
- - lib/resque/failure.rb
117
- - lib/resque/tasks.rb
118
- - lib/resque/logging.rb
118
+ - lib/resque/errors.rb
119
119
  - lib/resque/failure/airbrake.rb
120
+ - lib/resque/failure/base.rb
121
+ - lib/resque/failure/multiple.rb
120
122
  - lib/resque/failure/redis.rb
121
123
  - lib/resque/failure/redis_multi_queue.rb
122
- - lib/resque/failure/multiple.rb
123
- - lib/resque/failure/base.rb
124
+ - lib/resque/failure.rb
124
125
  - lib/resque/helpers.rb
126
+ - lib/resque/job.rb
125
127
  - lib/resque/log_formatters/quiet_formatter.rb
126
- - lib/resque/log_formatters/very_verbose_formatter.rb
127
128
  - lib/resque/log_formatters/verbose_formatter.rb
128
- - lib/resque/worker.rb
129
- - lib/resque/stat.rb
130
- - lib/resque/vendor/utf8_util/utf8_util_18.rb
131
- - lib/resque/vendor/utf8_util/utf8_util_19.rb
132
- - lib/resque/vendor/utf8_util.rb
129
+ - lib/resque/log_formatters/very_verbose_formatter.rb
130
+ - lib/resque/logging.rb
133
131
  - lib/resque/plugin.rb
134
- - lib/resque/version.rb
135
- - lib/resque/job.rb
136
- - lib/resque/server.rb
137
- - lib/resque/server/test_helper.rb
138
132
  - lib/resque/server/helpers.rb
139
- - lib/resque/server/views/failed_job.erb
140
- - lib/resque/server/views/overview.erb
141
- - lib/resque/server/views/error.erb
142
- - lib/resque/server/views/layout.erb
143
- - lib/resque/server/views/working.erb
144
- - lib/resque/server/views/stats.erb
145
- - lib/resque/server/views/failed_queues_overview.erb
146
- - lib/resque/server/views/key_string.erb
147
- - lib/resque/server/views/workers.erb
148
- - lib/resque/server/views/failed.erb
149
- - lib/resque/server/views/key_sets.erb
150
- - lib/resque/server/views/queues.erb
151
- - lib/resque/server/views/next_more.erb
152
- - lib/resque/server/public/ranger.js
153
- - lib/resque/server/public/jquery.relatize_date.js
154
- - lib/resque/server/public/jquery-1.3.2.min.js
155
133
  - lib/resque/server/public/favicon.ico
156
134
  - lib/resque/server/public/idle.png
157
- - lib/resque/server/public/working.png
135
+ - lib/resque/server/public/jquery-1.3.2.min.js
136
+ - lib/resque/server/public/jquery.relatize_date.js
158
137
  - lib/resque/server/public/poll.png
159
- - lib/resque/server/public/style.css
138
+ - lib/resque/server/public/ranger.js
160
139
  - lib/resque/server/public/reset.css
161
- - lib/resque/errors.rb
162
- - bin/resque-web
140
+ - lib/resque/server/public/style.css
141
+ - lib/resque/server/public/working.png
142
+ - lib/resque/server/test_helper.rb
143
+ - lib/resque/server/views/error.erb
144
+ - lib/resque/server/views/failed.erb
145
+ - lib/resque/server/views/failed_job.erb
146
+ - lib/resque/server/views/failed_queues_overview.erb
147
+ - lib/resque/server/views/key_sets.erb
148
+ - lib/resque/server/views/key_string.erb
149
+ - lib/resque/server/views/layout.erb
150
+ - lib/resque/server/views/next_more.erb
151
+ - lib/resque/server/views/overview.erb
152
+ - lib/resque/server/views/queues.erb
153
+ - lib/resque/server/views/stats.erb
154
+ - lib/resque/server/views/workers.erb
155
+ - lib/resque/server/views/working.erb
156
+ - lib/resque/server.rb
157
+ - lib/resque/stat.rb
158
+ - lib/resque/tasks.rb
159
+ - lib/resque/vendor/utf8_util/utf8_util_18.rb
160
+ - lib/resque/vendor/utf8_util/utf8_util_19.rb
161
+ - lib/resque/vendor/utf8_util.rb
162
+ - lib/resque/version.rb
163
+ - lib/resque/worker.rb
164
+ - lib/resque.rb
165
+ - lib/tasks/redis.rake
166
+ - lib/tasks/resque.rake
163
167
  - bin/resque
168
+ - bin/resque-web
164
169
  - test/airbrake_test.rb
165
- - test/plugin_test.rb
166
- - test/resque_failure_redis_test.rb
167
- - test/resque_test.rb
168
- - test/test_helper.rb
170
+ - test/dump.rdb
169
171
  - test/failure_base_test.rb
172
+ - test/job_hooks_test.rb
170
173
  - test/job_plugins_test.rb
171
174
  - test/logging_test.rb
175
+ - test/plugin_test.rb
176
+ - test/redis-test-cluster.conf
172
177
  - test/redis-test.conf
173
178
  - test/resque-web_test.rb
174
- - test/job_hooks_test.rb
175
- - test/worker_test.rb
176
- - test/redis-test-cluster.conf
179
+ - test/resque_failure_redis_test.rb
177
180
  - test/resque_hook_test.rb
181
+ - test/resque_test.rb
182
+ - test/test_helper.rb
183
+ - test/worker_test.rb
178
184
  homepage: http://github.com/defunkt/resque
179
185
  licenses: []
180
- metadata: {}
181
186
  post_install_message:
182
187
  rdoc_options:
183
188
  - --charset=UTF-8
184
189
  require_paths:
185
190
  - lib
186
191
  required_ruby_version: !ruby/object:Gem::Requirement
192
+ none: false
187
193
  requirements:
188
- - - '>='
194
+ - - ! '>='
189
195
  - !ruby/object:Gem::Version
190
196
  version: '0'
191
197
  required_rubygems_version: !ruby/object:Gem::Requirement
198
+ none: false
192
199
  requirements:
193
- - - '>='
200
+ - - ! '>'
194
201
  - !ruby/object:Gem::Version
195
- version: '0'
202
+ version: 1.3.1
196
203
  requirements: []
197
204
  rubyforge_project:
198
- rubygems_version: 2.0.14
205
+ rubygems_version: 1.8.24
199
206
  signing_key:
200
- specification_version: 4
207
+ specification_version: 3
201
208
  summary: Resque is a Redis-backed queueing system.
202
209
  test_files: []
203
210
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: f2ad41bcdf6fe0f0dac89963978925b803c42a1c
4
- data.tar.gz: 7aebfea98597ddfc13f12b408b1df008bfc6b632
5
- SHA512:
6
- metadata.gz: 9a20c5ee3d7808a893574e3fd907c96ed88c510414f5db29a44989ebc2379bb35db8d71ad60cee27a962e6e20d898e2d53657ecdbd08699ab5b6fd17a38df0be
7
- data.tar.gz: 8c841e2a57eee4404d669f469055c165885877d74e7f7b4d326099f9e0e74a66c225073ea88c336ac3b69f2406968310b6e12a2b0df2caa7769ccec4a7a46f5a