resque-pool 0.4.0.rc3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: faf10d33dce6efc9e10e62c0fcb8e8ab0e68f7be
4
- data.tar.gz: 00b0e5a60ca0bc806e65d86bc3ede09dc8988c0d
3
+ metadata.gz: e53fe4edb6e3714b9290bb7c5aaa38cfc0cba522
4
+ data.tar.gz: 14d005755bff347031cb00eca84a32cfe0745e74
5
5
  SHA512:
6
- metadata.gz: 600b56e3f0f6dcd2b9114b0f8a0e4ea66672415c5814b6d957beee91f3d642937529ab0d0bd3847ded91d646069cdd6995a9e1f6384a850f9cc35d84b0c889e1
7
- data.tar.gz: efa23c535e3dc82e22c2e8249da2c6c848e0a8c006dc4126d92c76f92ce3d510ef567ed69198b2514caf2d2c87aef2345fe7877841370fa03d2119d664035d49
6
+ metadata.gz: 70c830c5077481580b4dfc228f65607e1af4f8a8577a4993965820a4422e96422391df3fa65264e60f9f16169a9279bab231b7fac5c30ec0c06e65874564b334
7
+ data.tar.gz: da6496b4c8174cd7196a0175e4fe6abe111337b0ff99a442b1e82eb68a869924352298ad55b8a8855bb50a563703422d0d1aac24da82b937a3b64da4336c69f5
data/README.md CHANGED
@@ -70,17 +70,6 @@ the following into `lib/tasks/resque.rake`:
70
70
  end
71
71
  end
72
72
 
73
-
74
- For normal work with fresh resque and resque-scheduler gems add next lines in lib/rake/resque.rake
75
-
76
- ```ruby
77
- task 'resque:pool:setup' do
78
- Resque::Pool.after_prefork do |job|
79
- Resque.redis.client.reconnect
80
- end
81
- end
82
- ```
83
-
84
73
  ### Start the pool manager
85
74
 
86
75
  Then you can start the queues via:
data/lib/resque/pool.rb CHANGED
@@ -59,7 +59,7 @@ module Resque
59
59
  # Config: class methods to start up the pool using the default config {{{
60
60
 
61
61
  @config_files = ["resque-pool.yml", "config/resque-pool.yml"]
62
- class << self; attr_accessor :config_files, :app_name, :spawn_delay; end
62
+ class << self; attr_accessor :config_files, :app_name; end
63
63
 
64
64
  def self.app_name
65
65
  @app_name ||= File.basename(Dir.pwd)
@@ -215,13 +215,17 @@ module Resque
215
215
  when :INT
216
216
  graceful_worker_shutdown!(signal)
217
217
  when :TERM
218
- case self.class.term_behavior
219
- when "graceful_worker_shutdown_and_wait"
220
- graceful_worker_shutdown_and_wait!(signal)
221
- when "graceful_worker_shutdown"
218
+ if term_child
222
219
  graceful_worker_shutdown!(signal)
223
220
  else
224
- shutdown_everything_now!(signal)
221
+ case self.class.term_behavior
222
+ when "graceful_worker_shutdown_and_wait"
223
+ graceful_worker_shutdown_and_wait!(signal)
224
+ when "graceful_worker_shutdown"
225
+ graceful_worker_shutdown!(signal)
226
+ else
227
+ shutdown_everything_now!(signal)
228
+ end
225
229
  end
226
230
  end
227
231
  end
@@ -344,7 +348,6 @@ module Resque
344
348
  end
345
349
 
346
350
  def signal_all_workers(signal)
347
- log "Sending #{signal} to all workers"
348
351
  all_pids.each do |pid|
349
352
  Process.kill signal, pid
350
353
  end
@@ -372,7 +375,6 @@ module Resque
372
375
  def spawn_missing_workers_for(queues)
373
376
  worker_delta_for(queues).times do |nr|
374
377
  spawn_worker!(queues)
375
- sleep Resque::Pool.spawn_delay if Resque::Pool.spawn_delay
376
378
  end
377
379
  end
378
380
 
@@ -409,10 +411,6 @@ module Resque
409
411
  worker = ::Resque::Worker.new(*queues)
410
412
  worker.term_timeout = ENV['RESQUE_TERM_TIMEOUT'] || 4.0
411
413
  worker.term_child = ENV['TERM_CHILD']
412
- if worker.respond_to?(:run_at_exit_hooks=)
413
- # resque doesn't support this until 1.24, but we support 1.22
414
- worker.run_at_exit_hooks = ENV['RUN_AT_EXIT_HOOKS'] || false
415
- end
416
414
  if ENV['LOGGING'] || ENV['VERBOSE']
417
415
  worker.verbose = ENV['LOGGING'] || ENV['VERBOSE']
418
416
  end
@@ -1,13 +1,10 @@
1
1
  require 'trollop'
2
2
  require 'resque/pool'
3
- require 'resque/pool/logging'
4
3
  require 'fileutils'
5
4
 
6
5
  module Resque
7
6
  class Pool
8
7
  module CLI
9
- include Logging
10
- extend Logging
11
8
  extend self
12
9
 
13
10
  def run
@@ -41,7 +38,6 @@ where [options] are:
41
38
  opt :nosync, "Don't sync logfiles on every write"
42
39
  opt :pidfile, "PID file location", :type => String, :short => "-p"
43
40
  opt :environment, "Set RAILS_ENV/RACK_ENV/RESQUE_ENV", :type => String, :short => "-E"
44
- opt :spawn_delay, "Delay in milliseconds between spawning missing workers", :type => Integer, :short => "-s"
45
41
  opt :term_graceful_wait, "On TERM signal, wait for workers to shut down gracefully"
46
42
  opt :term_graceful, "On TERM signal, shut down workers gracefully"
47
43
  opt :term_immediate, "On TERM signal, shut down workers immediately (default)"
@@ -117,15 +113,6 @@ where [options] are:
117
113
  Resque::Pool.term_behavior = "graceful_worker_shutdown_and_wait"
118
114
  elsif opts[:term_graceful]
119
115
  Resque::Pool.term_behavior = "graceful_worker_shutdown"
120
- elsif ENV["TERM_CHILD"]
121
- log "TERM_CHILD enabled, so will user 'term-graceful-and-wait' behaviour"
122
- Resque::Pool.term_behavior = "graceful_worker_shutdown_and_wait"
123
- end
124
- if ENV.include?("DYNO") && !ENV["TERM_CHILD"]
125
- log "WARNING: Are you running on Heroku? You should probably set TERM_CHILD=1"
126
- end
127
- if opts[:spawn_delay]
128
- Resque::Pool.spawn_delay = opts[:spawn_delay] * 0.001
129
116
  end
130
117
  end
131
118
 
@@ -2,26 +2,14 @@ require 'resque/worker'
2
2
 
3
3
  class Resque::Pool
4
4
  module PooledWorker
5
-
6
- def initialize_with_pool(*args)
7
- @pool_master_pid = Process.pid
8
- initialize_without_pool(*args)
9
- end
10
-
11
- def pool_master_has_gone_away?
12
- @pool_master_pid && @pool_master_pid != Process.ppid
13
- end
14
-
15
- def shutdown_with_pool?
16
- shutdown_without_pool? || pool_master_has_gone_away?
5
+ def shutdown_with_pool
6
+ shutdown_without_pool || Process.ppid == 1
17
7
  end
18
8
 
19
9
  def self.included(base)
20
10
  base.instance_eval do
21
- alias_method :initialize_without_pool, :initialize
22
- alias_method :initialize, :initialize_with_pool
23
- alias_method :shutdown_without_pool?, :shutdown?
24
- alias_method :shutdown?, :shutdown_with_pool?
11
+ alias_method :shutdown_without_pool, :shutdown?
12
+ alias_method :shutdown?, :shutdown_with_pool
25
13
  end
26
14
  end
27
15
 
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  class Pool
3
- VERSION = "0.4.0.rc3"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.rc3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nicholas a. evans
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '1.16'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '1.16'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -172,9 +172,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  requirements:
175
- - - '>'
175
+ - - '>='
176
176
  - !ruby/object:Gem::Version
177
- version: 1.3.1
177
+ version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
180
  rubygems_version: 2.0.14