garbageman 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/garbageman.gemspec +2 -2
- data/lib/garbageman/collector.rb +4 -2
- data/lib/garbageman/config.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzY1ZjFmY2IxYjJhMzc0ZTNjNzdjNmFlZjBiNWY4ZmU5YmZjYTBiYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODQ1ODFhNDEzYTM0MzFmMGI5NjI4YTFiNDZkYWI5MmRmNDU0MDY1OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWQwOTFlMjhlOWY0NzA4Y2VhYWJiZTFmNDYwOTNmYzY0OWZiNDQ0NDAwZWFi
|
10
|
+
YWIxZDNmOWMwYzk2YzU4ZjU4ZDEwNWI4NjljYTIxNGIyYTUyZjE5OGNmOGIx
|
11
|
+
ODBjNDgwZjMyZTYyNjAyZWM4YTcxNTI2NWVmYjcwNGRmZDRjNTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTA4MGRhZTFmZmRmZGUxZjYxYzBhODQ5NjQxMGQ3ZmMxZmJiNjlkNGJlNWM5
|
14
|
+
ODJjMWJkZTE2YjhmZjdjMWUwZDcwNWVhYWZhOTNkYjU0Y2UyMTk1NjkyNTJl
|
15
|
+
MDk4ODA1ZTFkZjYzYjM0ZDZhZWMwMGE2ZDY3NTZiNTk0ZjEwODM=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.8
|
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.2.
|
5
|
+
# stub: garbageman 0.2.8 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "garbageman"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.8"
|
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
@@ -84,7 +84,9 @@ module GarbageMan
|
|
84
84
|
return
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
|
+
File.open(Config.gc_last_collected_file, 'w') { |f| f.write Time.now.to_i.to_s }
|
89
|
+
|
88
90
|
before_gc_callbacks.each(&:call)
|
89
91
|
|
90
92
|
write_gc_yaml server_index, STARTING
|
@@ -159,7 +161,7 @@ module GarbageMan
|
|
159
161
|
WRITE_MOVE_OPTIONS = {:force => true}
|
160
162
|
def write_gc_yaml(index, status)
|
161
163
|
config = {'gc' => {'server' => index, 'status' => status}}
|
162
|
-
File.open(Config.gc_yaml_tmp_file, 'w
|
164
|
+
File.open(Config.gc_yaml_tmp_file, 'w') { |f| f.write config.to_yaml }
|
163
165
|
# atomic write
|
164
166
|
FileUtils.mv Config.gc_yaml_tmp_file, Config.gc_yaml_file, WRITE_MOVE_OPTIONS
|
165
167
|
end
|
data/lib/garbageman/config.rb
CHANGED
@@ -11,6 +11,10 @@ module GarbageMan
|
|
11
11
|
def self.gc_yaml_tmp_file; @@gc_yaml_tmp_file ||= "./data/.tmp.gc.yml"; end
|
12
12
|
def self.gc_yaml_tmp_file=(file); @@gc_yaml_tmp_file = file; end
|
13
13
|
|
14
|
+
@@gc_last_collected_file = nil
|
15
|
+
def self.gc_last_collected_file; @@gc_last_collected_file ||= "./data/gc-last-collection-time.timestamp"; end
|
16
|
+
def self.gc_last_collected_file=(file); @@gc_last_collected_file = file; end
|
17
|
+
|
14
18
|
def self.gc_config
|
15
19
|
begin
|
16
20
|
File.exists?(self.gc_yaml_file) ? YAML.load_file(self.gc_yaml_file) : nil
|