garbageman 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/garbageman.gemspec +1 -1
- data/lib/garbageman/collector.rb +9 -2
- data/lib/garbageman/config.rb +1 -1
- data/lib/garbageman/rack/middleware.rb +1 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/garbageman.gemspec
CHANGED
data/lib/garbageman/collector.rb
CHANGED
@@ -13,7 +13,7 @@ module GarbageMan
|
|
13
13
|
|
14
14
|
include Status
|
15
15
|
|
16
|
-
attr_accessor :request_count, :will_collect
|
16
|
+
attr_accessor :request_count, :will_collect, :will_select_next_server
|
17
17
|
attr_reader :fiber_poll
|
18
18
|
|
19
19
|
def initialize
|
@@ -33,8 +33,11 @@ module GarbageMan
|
|
33
33
|
end
|
34
34
|
|
35
35
|
if select_next_server?
|
36
|
-
|
36
|
+
if @will_select_next_server
|
37
37
|
select_next_server
|
38
|
+
else
|
39
|
+
# wait until we receive another request before selecting the next server
|
40
|
+
@will_select_next_server = true
|
38
41
|
end
|
39
42
|
return true
|
40
43
|
end
|
@@ -109,6 +112,9 @@ module GarbageMan
|
|
109
112
|
end
|
110
113
|
|
111
114
|
def select_next_server
|
115
|
+
return unless @will_select_next_server
|
116
|
+
@will_select_next_server = false
|
117
|
+
|
112
118
|
Config.thin_config['servers'].times do |i|
|
113
119
|
next_server_index = (server_index + i + 1) % num_servers
|
114
120
|
file = socket_file next_server_index
|
@@ -123,6 +129,7 @@ module GarbageMan
|
|
123
129
|
def reset
|
124
130
|
@request_count = 0
|
125
131
|
@will_collect = false
|
132
|
+
@will_select_next_server = false
|
126
133
|
end
|
127
134
|
|
128
135
|
def busy?
|
data/lib/garbageman/config.rb
CHANGED
@@ -15,6 +15,7 @@ module GarbageMan
|
|
15
15
|
else
|
16
16
|
# this is not 100% preventable with nginx, nginx will still send requests while waiting for the health check response
|
17
17
|
GarbageMan::Collector.instance.logger.debug("still receiving traffic even though I'm waiting to GC") if GarbageMan::Collector.instance.will_collect
|
18
|
+
GarbageMan::Collector.instance.select_next_server if GarbageMan::Collector::instance.will_select_next_server
|
18
19
|
@app.call(env)
|
19
20
|
end
|
20
21
|
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.8
|
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: 1250881766983274641
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
none: false
|
108
108
|
requirements:
|