garbageman 0.1.10 → 0.1.11
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/VERSION +1 -1
- data/garbageman.gemspec +1 -1
- data/lib/garbageman/collector.rb +11 -2
- data/lib/garbageman/config.rb +7 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
data/garbageman.gemspec
CHANGED
data/lib/garbageman/collector.rb
CHANGED
@@ -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? &&
|
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
|
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
|
|
data/lib/garbageman/config.rb
CHANGED
@@ -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
|
-
|
22
|
-
def self.
|
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.
|
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:
|
105
|
+
hash: 2990565593376099137
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|