eureka_ruby 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7784c42fe43339752201acf900892cf379bf233b811aaaebc31c1ccddc0ac3b
|
4
|
+
data.tar.gz: 3ce81d17b8d152dff01b1a32b42ca51bb0c9b35e33dc3a4340d962a29b811b2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b99401c0647e240e7c092f5e93a9f3019f7ce35a478647bd3eef303801b947f297ae4d30607957232b68c7d1bbd39f5bc011bdee102ddf645da031523d7b1f21
|
7
|
+
data.tar.gz: 9369ddb6fc827a00af76fcbebeb94d9b6d6bb529b075018b11e6c8bbe860435f25c260e125c57c608347dbc48712489143d84844ef760bd94c1b18194b4e5336
|
@@ -34,15 +34,18 @@ module EurekaRuby
|
|
34
34
|
|
35
35
|
def request(path)
|
36
36
|
response = yield("#{base}#{path}")
|
37
|
-
return response if [200, 204].include? response.status
|
38
37
|
|
39
|
-
|
40
|
-
|
38
|
+
unless [200, 204].include? response.status
|
39
|
+
puts <<-ERROR
|
40
|
+
EurekaRequestError:
|
41
41
|
request: #{path}
|
42
42
|
response:
|
43
43
|
status: #{response.status}
|
44
44
|
body: #{response.body}
|
45
|
-
|
45
|
+
ERROR
|
46
|
+
end
|
47
|
+
|
48
|
+
response
|
46
49
|
end
|
47
50
|
end
|
48
51
|
end
|
data/lib/eureka_ruby/version.rb
CHANGED
@@ -24,13 +24,16 @@ if ENV['EUREKA']
|
|
24
24
|
# Keep Living
|
25
25
|
Thread.new do
|
26
26
|
loop do
|
27
|
-
EurekaRuby.executor.run(:send_heartbeat)
|
28
|
-
|
29
|
-
|
27
|
+
response = EurekaRuby.executor.run(:send_heartbeat)
|
28
|
+
next if [200, 204].include? response.status
|
29
|
+
|
30
|
+
EurekaRuby.executor.run(:register) if response.status == 404
|
31
|
+
|
32
|
+
error_text = "发送心跳到 Eureka 失败: status: #{response.status} body: #{response.body.to_s}"
|
30
33
|
Rails.logger.error(error_text)
|
31
34
|
NewRelic::Agent.notice_error(error_text) if defined?(NewRelic)
|
32
35
|
ensure
|
33
|
-
sleep ENV.fetch('EUREKA_HEARTBEAT_PERIOD',
|
36
|
+
sleep ENV.fetch('EUREKA_HEARTBEAT_PERIOD', 5).to_i
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eureka_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 乌托邦科技
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|