garbageman 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/garbageman.gemspec +2 -2
- data/lib/garbageman/collector.rb +8 -3
- data/lib/garbageman/config.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yjk5NjhlMWEyOWE1M2M5ZGQ1ZGQwOGM5MzY5NGNkNTQxMmMyNmY4Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGQzY2QyMDNlYzZhNDk4YTI0MmI1MmZjYzQ5MTZmMmVkNmQ5ZjM4Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmYxYzdlNDI3MWU4NTJhZjc4YzA3MTkwZjc0MTdlYTQ1ZTE5YzQwNjEwZmE5
|
10
|
+
MmY0N2QxYzVhODVmZDFlZDU4MDhlN2RhOTgzYTVlODQ2YzdlZWRhODllYzBh
|
11
|
+
NmEzMjlmODMyMDQxNTgzNGU4MGJkM2Q5N2E4MDA5YmMwYzg4ZjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWZmMDIxNjk0NjFiNzdlN2I5M2EwODFlMDg1NzU1ODJlMTdmMDFkOGJhMmRj
|
14
|
+
ODBkYjEzNjdkMzM5NDAxYzJhMDIwMjU5ODE3MTIyNzkwZDNlZDY3ZDc4MGU5
|
15
|
+
MTgwYzA1MDBhMWQ0OTM2Njc0MTVlNzg3MGUwNjk0OTI3NTAzMzQ=
|
data/garbageman.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: garbageman 0.3.
|
5
|
+
# stub: garbageman 0.3.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "garbageman"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
data/lib/garbageman/collector.rb
CHANGED
@@ -30,6 +30,7 @@ module GarbageMan
|
|
30
30
|
|
31
31
|
def initialize
|
32
32
|
@show_gc_times = true
|
33
|
+
@show_memory_released = false
|
33
34
|
@before_gc_callbacks = []
|
34
35
|
@after_gc_callbacks = []
|
35
36
|
reset
|
@@ -91,13 +92,17 @@ module GarbageMan
|
|
91
92
|
|
92
93
|
write_gc_yaml server_index, STARTING
|
93
94
|
debug "starting gc"
|
94
|
-
memory_used = @
|
95
|
+
memory_used = @show_memory_released ? process_resident_memory_size_in_kb : 0
|
95
96
|
starts = Time.now
|
96
97
|
GC.enable
|
97
|
-
Config.gc_starts.times
|
98
|
+
Config.gc_starts.times do
|
99
|
+
GC.start
|
100
|
+
sleep(Config.gc_sleep) if Config.gc_sleep > 0
|
101
|
+
end
|
98
102
|
@last_gc_finished_at = Time.now
|
99
103
|
diff = (@last_gc_finished_at - starts) * 1000
|
100
|
-
info "GC took #{'%.2f' % diff}ms for #{@request_count} requests
|
104
|
+
info "GC took #{'%.2f' % diff}ms for #{@request_count} requests" if @show_gc_times
|
105
|
+
info "GC freed #{memory_used - process_resident_memory_size_in_kb}kb of memory" if @show_memory_released
|
101
106
|
write_gc_yaml server_index, NEXT_SERVER
|
102
107
|
|
103
108
|
after_gc_callbacks.each(&:call)
|
data/lib/garbageman/config.rb
CHANGED
@@ -57,12 +57,12 @@ module GarbageMan
|
|
57
57
|
def self.max_connection_drain_time; @@max_connection_drain_time; end
|
58
58
|
def self.max_connection_drain_time=(time); @@max_connection_drain_time = time; end
|
59
59
|
|
60
|
-
@@gc_starts =
|
60
|
+
@@gc_starts = 1
|
61
61
|
def self.gc_starts; @@gc_starts; end
|
62
62
|
def self.gc_starts=(v); @@gc_starts = v; end
|
63
63
|
|
64
|
-
@@gc_sleep = 0.
|
64
|
+
@@gc_sleep = 0.00
|
65
65
|
def self.gc_sleep; @@gc_sleep; end
|
66
|
-
def self.gc_sleep=(v); @@gc_sleep = v; end
|
66
|
+
def self.gc_sleep=(v); @@gc_sleep = v || 10; end
|
67
67
|
end
|
68
68
|
end
|