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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWI5MGIyNWM4YzY5N2RkNzcyYjVjMWQ3NTJhYTg0YzAxYjJhNTVmMA==
4
+ Yjk5NjhlMWEyOWE1M2M5ZGQ1ZGQwOGM5MzY5NGNkNTQxMmMyNmY4Yw==
5
5
  data.tar.gz: !binary |-
6
- M2Y5MjA0MTAzZWViOTg5YzMxZGQyMjAzNmQwYjgzNmE5NGU5MTA1Yg==
6
+ ZGQzY2QyMDNlYzZhNDk4YTI0MmI1MmZjYzQ5MTZmMmVkNmQ5ZjM4Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmQ0MmIzMGMyYTcwZDA2ZTYyNGQyYWE2MWZkMWM5YTExZGU0YTk1YjM5MmEy
10
- MWJmMDJjZDNiMzM1ZjhmODZjOGY0MTFmYzNkMDk4MzBiZWRkMDM2N2ZhNDgy
11
- ZWY3YTAzYzc4MTE5OTQ4YmI4YmRiOTEyMGIwZDhjM2MyOGU5NDI=
9
+ NmYxYzdlNDI3MWU4NTJhZjc4YzA3MTkwZjc0MTdlYTQ1ZTE5YzQwNjEwZmE5
10
+ MmY0N2QxYzVhODVmZDFlZDU4MDhlN2RhOTgzYTVlODQ2YzdlZWRhODllYzBh
11
+ NmEzMjlmODMyMDQxNTgzNGU4MGJkM2Q5N2E4MDA5YmMwYzg4ZjU=
12
12
  data.tar.gz: !binary |-
13
- M2IwZjMzMzkzZWMyNDNhODY2ZjVjOTEzNWY5MDVjYzFhODdhMjMwMWVlZjVh
14
- OTVhZjJhNWFmZjZmNDIyYTViNmQzYjQ4YzIwN2E0NzJhZmQ2YTEwNTljMDhh
15
- ODRjNWZhMjZhNTVkYjRhMjBjZjA5MjcyNDA4NTkwY2YzZTdlZjY=
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.0 ruby lib
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.0"
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"]
@@ -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 = @show_gc_times ? process_resident_memory_size_in_kb : 0
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 { GC.start; sleep Config.gc_sleep }
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, and freed #{memory_used - process_resident_memory_size_in_kb}kb of memory" if @show_gc_times
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)
@@ -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 = 20
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.05
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
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.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch