unicorn-worker-killer 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ Release 0.3.2 - 2013/02/03
2
+ * add an option to disable the check for both MaxRequests and MaxMemory
3
+
1
4
  Release 0.3.1 - 2013/01/13
2
5
  * fix for ruby 1.9.2
3
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -40,10 +40,11 @@ module Unicorn::WorkerKiller
40
40
  end
41
41
 
42
42
  def process_client(client)
43
- @_worker_process_start ||= Time.now
44
- @_worker_memory_limit ||= @_worker_memory_limit_min + Random.rand(@_worker_memory_limit_max-@_worker_memory_limit_min+1)
45
43
  super(client) # Unicorn::HttpServer#process_client
44
+ return if @_worker_memory_limit_min == 0 && @_worker_memory_limit_max == 0
46
45
 
46
+ @_worker_process_start ||= Time.now
47
+ @_worker_memory_limit ||= @_worker_memory_limit_min + Random.rand(@_worker_memory_limit_max-@_worker_memory_limit_min+1)
47
48
  @_worker_check_count += 1
48
49
  if @_worker_check_count % @_worker_check_cycle == 0
49
50
  rss = _worker_rss()
@@ -103,11 +104,12 @@ module Unicorn::WorkerKiller
103
104
  end
104
105
 
105
106
  def process_client(client)
107
+ super(client) # Unicorn::HttpServer#process_client
108
+ return if @_worker_max_requests_min == 0 && @_worker_max_requests_max == 0
109
+
106
110
  @_worker_process_start ||= Time.now
107
111
  @_worker_cur_requests ||= @_worker_max_requests_min + Random.rand(@_worker_max_requests_max-@_worker_max_requests_min+1)
108
112
  @_worker_max_requests ||= @_worker_cur_requests
109
- super(client) # Unicorn::HttpServer#process_client
110
-
111
113
  if (@_worker_cur_requests -= 1) <= 0
112
114
  logger.warn "#{self}: worker (pid: #{Process.pid}) exceeds max number of requests (limit: #{@_worker_max_requests})"
113
115
  Unicorn::WorkerKiller.kill_self(logger, @_worker_process_start)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn-worker-killer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-14 00:00:00.000000000 Z
13
+ date: 2013-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: unicorn
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 1.8.24
84
+ rubygems_version: 1.8.23
85
85
  signing_key:
86
86
  specification_version: 3
87
87
  summary: Kill unicorn workers by memory and request counts