web47core 3.2.3.47 → 3.2.3.48
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.
- checksums.yaml +4 -4
- data/app/controllers/status_controller.rb +12 -10
- data/lib/web47core/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b460458978fdba54209f884a08fd57d1407bb02e4542ed559f9198aa918eb162
|
|
4
|
+
data.tar.gz: b3d3c901f101674abe9be6cdafa8e2f866f795826b1a6ce00aedc49ad6802428
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a6ae3bf153a29041e5bf6b2c1e13f611a7056036dd50729e9c592b89d9015347b7fe9a5d2a5e584cad78fa4757b9f6e0ddd0720f91d233ba5feb27277f1989c
|
|
7
|
+
data.tar.gz: e5100c2ef32e912f2b7f03afa453f2895f17879805e7dfaf4f17c3ce078de54f87d53e1e4604c5e00b0b82d7f9ed24fca4ffd46dc073b7dc2e1bca1caf8d9206
|
|
@@ -10,7 +10,7 @@ class StatusController < ActionController::Base
|
|
|
10
10
|
#
|
|
11
11
|
def index
|
|
12
12
|
components = { mongo: mongo_status,
|
|
13
|
-
|
|
13
|
+
cache: cache_status,
|
|
14
14
|
jobs: delayed_jobs_status,
|
|
15
15
|
cron_job_servers: cron_job_servers_status,
|
|
16
16
|
workers: workers_status,
|
|
@@ -26,10 +26,10 @@ class StatusController < ActionController::Base
|
|
|
26
26
|
private
|
|
27
27
|
|
|
28
28
|
#
|
|
29
|
-
# Return the status of the key components, mongo,
|
|
29
|
+
# Return the status of the key components, mongo, cache
|
|
30
30
|
#
|
|
31
31
|
def db_status(components)
|
|
32
|
-
components[:mongo][:success] && components[:
|
|
32
|
+
components[:mongo][:success] && components[:cache][:success] ? 200 : 500
|
|
33
33
|
rescue StandardError
|
|
34
34
|
500
|
|
35
35
|
end
|
|
@@ -75,18 +75,20 @@ class StatusController < ActionController::Base
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
#
|
|
78
|
-
#
|
|
78
|
+
# Cache Status
|
|
79
79
|
#
|
|
80
|
-
def
|
|
80
|
+
def cache_status
|
|
81
81
|
value = SecureRandom.hex(32)
|
|
82
|
-
key = "
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
key = "cache-status-check-#{SecureRandom.hex(16)}"
|
|
83
|
+
cache = Rails.cache
|
|
84
|
+
write_result = cache.write(key, value, expires_in: 15.seconds)
|
|
85
|
+
cached_value = cache.read(key)
|
|
85
86
|
unless value.eql?(cached_value)
|
|
86
|
-
raise "
|
|
87
|
+
raise "Cache not available (#{cache.class.name}): Expected: #{value} with key #{key}, " \
|
|
88
|
+
"but got #{cached_value.inspect}; write returned #{write_result.inspect}"
|
|
87
89
|
end
|
|
88
90
|
|
|
89
|
-
report_success '
|
|
91
|
+
report_success 'Cache Available', count: 1
|
|
90
92
|
rescue StandardError => error
|
|
91
93
|
report_error(error, count: 0)
|
|
92
94
|
end
|
data/lib/web47core/version.rb
CHANGED