usps-support 0.2.53 → 0.2.55
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/usps/support/health_controller.rb +24 -2
- data/db/hq/websites_schema.rb +1 -1
- data/lib/usps/support/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: 2c0cf433c2d144a8f87a14bd3dcb7dea7715d0f567a2373ae94995d8f6bebf24
|
|
4
|
+
data.tar.gz: a219ef3451fd7afa40ece594f54119ea29923d981f53ce84b3213b7d0c1419d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52e39a4662db847d220472723875c1bb9f45eb97f01e8484969703e6ae946dee9872063186bf2d37b2fd400a3efdc594f4b2d77409eac38046ef63264f71d685
|
|
7
|
+
data.tar.gz: a6a4fad3524230632c11f668dd5b190b21f9010bb5ad7579cc7e295222bdd4b86679a5016328143c9801bf907063f57f6b03b0d7d9800d9740298886cc7121ed
|
|
@@ -20,6 +20,11 @@ module Usps::Support
|
|
|
20
20
|
# and route to it (`get 'health' => 'health#show'`). For a bespoke dependency, define a
|
|
21
21
|
# #check_<name> in the subclass (e.g. wrapping #check_http(url)) and add <name> to CHECKS.
|
|
22
22
|
#
|
|
23
|
+
# Responds 503 when any check fails, EXCEPT to callers that pass ?probe=1, which always get 200
|
|
24
|
+
# and are expected to judge health by the sentinel in the body. That exists so a failing
|
|
25
|
+
# dependency does not register as an application 5XX on the load balancer -- see #response_status.
|
|
26
|
+
# Point external string-matching probes at /health?probe=1; leave it off everywhere else.
|
|
27
|
+
#
|
|
23
28
|
# Checks run on a background thread, not the request thread: a per-process refresher updates a
|
|
24
29
|
# cached snapshot every health_refresh_interval seconds and #show serves that snapshot, so a slow
|
|
25
30
|
# or wedged dependency can't tie up the Passenger worker pool. Each check also runs under
|
|
@@ -124,7 +129,7 @@ module Usps::Support
|
|
|
124
129
|
|
|
125
130
|
response.set_header('Cache-Control', 'no-store')
|
|
126
131
|
response.set_header('Retry-After', '30') unless healthy
|
|
127
|
-
render(plain: body, content_type: 'text/plain', status: healthy
|
|
132
|
+
render(plain: body, content_type: 'text/plain', status: response_status(healthy))
|
|
128
133
|
end
|
|
129
134
|
|
|
130
135
|
# Fallback for the (rare) case where not even the first refresh could produce a snapshot.
|
|
@@ -132,9 +137,26 @@ module Usps::Support
|
|
|
132
137
|
response.set_header('Cache-Control', 'no-store')
|
|
133
138
|
response.set_header('Retry-After', '30')
|
|
134
139
|
render(plain: "HEALTHCHECK_FAIL #{app_name}\nsnapshot=unavailable\n",
|
|
135
|
-
content_type: 'text/plain', status:
|
|
140
|
+
content_type: 'text/plain', status: response_status(false))
|
|
136
141
|
end
|
|
137
142
|
|
|
143
|
+
# True when the caller asked to be judged on the body alone (?probe=1).
|
|
144
|
+
def probe_mode? = params[:probe].present?
|
|
145
|
+
|
|
146
|
+
# A Route 53 HTTPS_STR_MATCH probe decides health by matching the sentinel in the body, so for it
|
|
147
|
+
# the status code says nothing the body has not already said. That redundancy is not free: the
|
|
148
|
+
# ALB counts a 503 on this path as an application 5XX, landing it in HTTPCode_Target_5XX_Count
|
|
149
|
+
# next to genuine user-facing errors. A slow dependency then pages on an endpoint no user ever
|
|
150
|
+
# touched (2026-08-05: 155 such 5XX across exams and merit-marks, all of them this endpoint
|
|
151
|
+
# answering the Route 53 checker, none of them a real request).
|
|
152
|
+
#
|
|
153
|
+
# Probe-mode callers therefore get 200 with the identical body -- still HEALTHCHECK_FAIL, still
|
|
154
|
+
# every per-check line, so the probe goes red exactly as before. Everyone else keeps the
|
|
155
|
+
# status-coded contract, which is what a human curl or a status-code-driven monitor expects.
|
|
156
|
+
# A crashed app or dead worker still yields the web server's own 5xx with no sentinel, so total
|
|
157
|
+
# failure remains detectable either way.
|
|
158
|
+
def response_status(healthy) = healthy || probe_mode? ? :ok : :service_unavailable
|
|
159
|
+
|
|
138
160
|
# One round of checks + diagnostics, invoked by the monitor's runner (background thread, or the
|
|
139
161
|
# inline cold/stale path). Wrapped in the Rails executor so ActiveRecord connections checked out
|
|
140
162
|
# by the DB checks are returned even though this runs outside a request. Returns the render data.
|
data/db/hq/websites_schema.rb
CHANGED
|
@@ -74,7 +74,7 @@ ActiveRecord::Schema[8.1].define do
|
|
|
74
74
|
t.index ["sqnumber"], name: "csq_index"
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
create_table "students", id: :integer, charset: "latin1", comment: "dtb-Active eddept HQ800 students", options: "ENGINE=
|
|
77
|
+
create_table "students", id: :integer, charset: "latin1", comment: "dtb-Active eddept HQ800 students", options: "ENGINE=InnoDB", force: :cascade do |t|
|
|
78
78
|
t.string "csl", limit: 1
|
|
79
79
|
t.string "crsid", limit: 17
|
|
80
80
|
t.string "start", limit: 6
|
data/lib/usps/support/version.rb
CHANGED