perfectqueue 0.8.6 → 0.8.7

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ == 2012-07-26 version 0.8.7
3
+
4
+ * Worker process changes process name ($0)
5
+ * Use EMT instead of WINCH signal for immediate binary replace
6
+ * Use WINCH instead of CONT signal for graceful binary replace
7
+
8
+
2
9
  == 2012-07-23 version 0.8.6
3
10
 
4
11
  * rdb_backend supports 'max_running' which is added in v0.7.21
data/README.md CHANGED
@@ -146,8 +146,8 @@ PerfectQueue::Worker.run(Dispatch) {
146
146
  - **QUIT:** immediate shutdown
147
147
  - **USR1:** graceful restart
148
148
  - **HUP:** immediate restart
149
- - **WINCH:** immediate binary replace
150
- - **CONT:** graceful binary replace
149
+ - **EMT:** immediate binary replace
150
+ - **WINCH:** graceful binary replace
151
151
  - **USR2:** reopen log files
152
152
 
153
153
  ## Configuration
@@ -51,7 +51,7 @@ module PerfectQueue
51
51
  extra = num_processors - @processors.length
52
52
  if extra > 0
53
53
  extra.times do
54
- @processors << @processor_class.new(@runner, config)
54
+ @processors << @processor_class.new(@runner, @processors.size+1, config)
55
55
  end
56
56
  elsif extra < 0
57
57
  -extra.times do
@@ -24,11 +24,11 @@ module PerfectQueue
24
24
  new(runner, config, wpipe).run
25
25
  end
26
26
 
27
- def initialize(runner, config, wpipe)
27
+ def initialize(runner, processor_id, config, wpipe)
28
28
  @wpipe = wpipe
29
29
  @wpipe.sync = true
30
30
  @request_per_child = 0
31
- super(runner, config)
31
+ super(runner, processor_id, config)
32
32
  @sig = install_signal_handlers
33
33
  end
34
34
 
@@ -95,7 +95,7 @@ module PerfectQueue
95
95
  @log.debug "sending SIGKILL to pid=#{@pid} for immediate stop"
96
96
  Process.kill(:KILL, @pid)
97
97
  else
98
- @log.debug "sending SIGUSR1 to pid=#{@pid} for graceful stop"
98
+ @log.debug "sending SIGTERM to pid=#{@pid} for graceful stop"
99
99
  Process.kill(:TERM, @pid)
100
100
  end
101
101
  rescue Errno::ESRCH, Errno::EPERM
@@ -20,8 +20,9 @@ module PerfectQueue
20
20
  module Multiprocess
21
21
 
22
22
  class ForkProcessor
23
- def initialize(runner, config)
23
+ def initialize(runner, processor_id, config)
24
24
  @runner = runner
25
+ @processor_id = processor_id
25
26
 
26
27
  require 'fcntl'
27
28
  @stop = false
@@ -124,6 +125,9 @@ module PerfectQueue
124
125
  INTER_FORK_LOCK = Mutex.new
125
126
 
126
127
  def fork_child
128
+ # set process name
129
+ $0 = "perfectqueue:#{@runner} #{@processor_id}"
130
+
127
131
  @runner.before_fork if @runner.respond_to?(:before_fork) # TODO exception handling
128
132
 
129
133
  INTER_FORK_LOCK.lock
@@ -20,8 +20,9 @@ module PerfectQueue
20
20
  module Multiprocess
21
21
 
22
22
  class ThreadProcessor
23
- def initialize(runner, config)
23
+ def initialize(runner, processor_id, config)
24
24
  @runner = runner
25
+ @processor_id = processor_id
25
26
 
26
27
  @running_flag = BlockingFlag.new
27
28
  @finish_flag = BlockingFlag.new
@@ -1,3 +1,3 @@
1
1
  module PerfectQueue
2
- VERSION = "0.8.6"
2
+ VERSION = "0.8.7"
3
3
  end
@@ -132,11 +132,11 @@ module PerfectQueue
132
132
  restart(true)
133
133
  end
134
134
 
135
- sig.trap :CONT do
135
+ sig.trap :WINCH do
136
136
  replace(false)
137
137
  end
138
138
 
139
- sig.trap :WINCH do
139
+ sig.trap :EMT do
140
140
  replace(true)
141
141
  end
142
142
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perfectqueue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-24 00:00:00.000000000 Z
12
+ date: 2012-07-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel