health_check 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -0
- data/lib/health_check/health_check_controller.rb +3 -2
- data/lib/health_check/version.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -188,6 +188,16 @@ For example, with lograge use the following to exclude health_check from being l
|
|
188
188
|
|
189
189
|
Likewise you will probably want to exclude health_check from monitoring systems like newrelic.
|
190
190
|
|
191
|
+
== Caching
|
192
|
+
|
193
|
+
Cache-control is set with
|
194
|
+
* public if max_age is > 1 and basic_auth_username is not set (otherwise private)
|
195
|
+
* no-cache
|
196
|
+
* must-revalidate
|
197
|
+
* max-age (default 1)
|
198
|
+
|
199
|
+
Last-modified is set to the current time (rounded down to a multiple of max_age when max_age > 1)
|
200
|
+
|
191
201
|
== Note on Patches/Pull Requests
|
192
202
|
|
193
203
|
<em>Feedback welcome! Especially with suggested replacement code and corresponding tests</em>
|
@@ -13,7 +13,8 @@ module HealthCheck
|
|
13
13
|
if max_age > 1
|
14
14
|
last_modified = Time.at((last_modified.to_f / max_age).floor * max_age).utc
|
15
15
|
end
|
16
|
-
|
16
|
+
public = (max_age > 1) && ! basic_auth_username
|
17
|
+
if stale?(:last_modified => last_modified, :public => public)
|
17
18
|
# Rails 4.0 doesn't have :plain, but it is deprecated later on
|
18
19
|
plain_key = Rails.version < '4.1' ? :text : :plain
|
19
20
|
checks = params[:checks] || 'standard'
|
@@ -22,7 +23,7 @@ module HealthCheck
|
|
22
23
|
rescue Exception => e
|
23
24
|
errors = e.message.blank? ? e.class.to_s : e.message.to_s
|
24
25
|
end
|
25
|
-
response.headers['Cache-control'] = 'private, no-cache, must-revalidate' + (max_age > 0 ? ", max-age=#{max_age}" : '')
|
26
|
+
response.headers['Cache-control'] = (public ? 'public' : 'private') + ', no-cache, must-revalidate' + (max_age > 0 ? ", max-age=#{max_age}" : '')
|
26
27
|
if errors.blank?
|
27
28
|
obj = { :healthy => true, :message => HealthCheck.success }
|
28
29
|
respond_to do |format|
|
data/lib/health_check/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: health_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-07-
|
12
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|