little-dutch 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/little-dutch.rb +15 -4
- data/lib/little-dutch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97ee749c6b2850b9efd6d388d0f38d4ed10875b4
|
4
|
+
data.tar.gz: 867bcd2717a1887eee00e9b1fb25b1c716de2b6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd10af110d1360b8327764f8f5c73edeeec306a24a407a60642ef6e48c745f70c9a778ccfa334aa04aec3e4a42deb04aeafdcc824623a356acf133fcf9eb09f6
|
7
|
+
data.tar.gz: 71ceb93354c055c29f82eacde2f1ade9b72ac7b99338afeb5a8e1c5993ce4a1e872eaa32393918c1d91dc5440acb222167f611fcdf0fc1963073c49e85a6838a
|
data/lib/little-dutch.rb
CHANGED
@@ -26,13 +26,24 @@ module LittleDutch
|
|
26
26
|
@runner.try(:kill)
|
27
27
|
end
|
28
28
|
|
29
|
+
def profile_instance?
|
30
|
+
url = URI.parse(config.endpoint)
|
31
|
+
url.path = "/r/#{config.app_name}/#{config.instance_id}"
|
32
|
+
url.query = { token: config.token }.to_param
|
33
|
+
Faraday.get(url).status == 200
|
34
|
+
rescue Faraday::ConnectionFailed
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
29
38
|
private
|
30
39
|
|
31
40
|
def run_loop
|
32
41
|
@runcount = 0
|
33
42
|
loop do
|
34
|
-
|
35
|
-
|
43
|
+
if profile_instance?
|
44
|
+
@runcount += 1
|
45
|
+
post_json ObjectSpace.dump_all
|
46
|
+
end
|
36
47
|
sleep config.interval
|
37
48
|
end
|
38
49
|
end
|
@@ -49,9 +60,9 @@ module LittleDutch
|
|
49
60
|
url = URI.parse(config.endpoint)
|
50
61
|
url.path = "/r/#{config.app_name}/#{config.instance_id}/#{@runcount}"
|
51
62
|
url.query = { token: config.token }.to_param
|
52
|
-
|
63
|
+
file_path = file.tap(&:close).path
|
53
64
|
curl_cmd = <<-SHELL.lines.map(&:strip).join(' ; ')
|
54
|
-
curl -X POST --retry 10 -H "Transfer-Encoding: chunked" -H "Content-Type: application/text" --data-binary @#{
|
65
|
+
curl -X POST --retry 10 -H "Transfer-Encoding: chunked" -H "Content-Type: application/text" --data-binary @#{file_path} #{url.to_s}
|
55
66
|
rm -f #{file}
|
56
67
|
SHELL
|
57
68
|
Process.spawn curl_cmd, out: config.logfile, err: config.logfile, in: '/dev/null'
|
data/lib/little-dutch/version.rb
CHANGED