garbageman 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.10
1
+ 0.1.11
data/garbageman.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "garbageman"
8
- s.version = "0.1.10"
8
+ s.version = "0.1.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Doug Youch"]
@@ -98,6 +98,7 @@ module GarbageMan
98
98
 
99
99
  def select_next_server
100
100
  return unless @will_select_next_server
101
+ return unless @request_count >= Config.num_request_before_selecting_next_server
101
102
  @will_select_next_server = false
102
103
 
103
104
  Config.thin_config['servers'].times do |i|
@@ -164,8 +165,16 @@ module GarbageMan
164
165
  config && config['gc'] && config['gc']['server'] && config['gc']['server'] == server_index && config['gc']['status'] == 'next_server'
165
166
  end
166
167
 
168
+ def forcing_gc?
169
+ File.exists?(Config.enable_gc_file)
170
+ end
171
+
172
+ def not_forcing_gc?
173
+ ! forcing_gc?
174
+ end
175
+
167
176
  def can_disable?
168
- Config.thin_config.has_key?('socket') && not_queuing? && min_running_servers?
177
+ Config.thin_config.has_key?('socket') && not_queuing? && not_forcing_gc? && enough_running_servers?
169
178
  end
170
179
 
171
180
  def num_running_servers
@@ -177,7 +186,7 @@ module GarbageMan
177
186
  end
178
187
 
179
188
  # make sure there are 3 or more servers running before disabling gc
180
- def min_running_servers?
189
+ def enough_running_servers?
181
190
  num_servers >= Config.min_servers_to_disable_gc && num_running_servers >= Config.min_servers_to_disable_gc
182
191
  end
183
192
 
@@ -18,7 +18,12 @@ module GarbageMan
18
18
  @@thin_config = nil
19
19
  def self.thin_config; @@thin_config ||= YAML.load_file("./config/thin.yml"); end
20
20
 
21
- def self.num_request_before_collecting; 10; end
22
- def self.min_servers_to_disable_gc; 3; end
21
+ @@enable_gc_file = "./data/enable_gc"
22
+ def self.enable_gc_file; @@enable_gc_file; end
23
+
24
+ def self.num_request_before_collecting; 20; end
25
+ # absolutely make sure we are in the pool again before selecting next server
26
+ def self.num_request_before_selecting_next_server; 10; end
27
+ def self.min_servers_to_disable_gc; 2; end
23
28
  end
24
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garbageman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: 3623494067155397432
105
+ hash: 2990565593376099137
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements: