cf_light_api 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/cf_light_api.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b445bb4b226594c287865ab11856d26ead5ef2
|
4
|
+
data.tar.gz: c35504e2c5c7650b80d8646370f199a993f9f9b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5abe583323af2e9bf05da0413d48cb0fe5e637fd71194a8b860a83f643a8676aa938f4099948a61c81edcc53959203a399e95aaf9fffa1de7a694f56ca0db0d
|
7
|
+
data.tar.gz: e65c0b5f048454d2551c534709c6f85be6b4dcb68534fffe1cf2c28708b894e9e54872c5447d7c8398c30cfaf83f4088497dbe213aa0a62bab0a56efa6e2ef6e
|
data/lib/sinatra/cf_light_api.rb
CHANGED
@@ -25,6 +25,19 @@ module Sinatra
|
|
25
25
|
content_type :json
|
26
26
|
REDIS.get("#{ENV['REDIS_KEY_PREFIX']}:last_updated")
|
27
27
|
end
|
28
|
+
|
29
|
+
app.get '/internal/status' do
|
30
|
+
content_type :json
|
31
|
+
updated = REDIS.get("#{ENV['REDIS_KEY_PREFIX']}:last_updated")
|
32
|
+
last_updated = JSON.parse(updated)
|
33
|
+
updated_datetime = DateTime.parse(last_updated["last_updated"])
|
34
|
+
seconds_since_update = ((DateTime.now - updated_datetime) * 24 * 60 * 60).to_i
|
35
|
+
if seconds_since_update >= 300
|
36
|
+
status 503
|
37
|
+
end
|
38
|
+
"{}"
|
39
|
+
end
|
40
|
+
|
28
41
|
end
|
29
42
|
|
30
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf_light_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Springer Platform Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cfoundry
|