File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
15+ import Fluent
16+ import Plot
17+ import Vapor
18+
19+ enum UptimeCheckController {
20+
21+ @Sendable
22+ static func show( req: Request ) async throws -> String {
23+ // A package page query is a good test of whether the site is healthy.
24+ let ( _, _) = try await API . PackageController. GetRoute
25+ . query ( on: req. db,
26+ owner: " SwiftPackageIndex " ,
27+ repository: " SemanticVersion " )
28+ return " Success "
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ enum SiteURL: Resourceable, Sendable {
134134 case stylesheets( String )
135135 case supporters
136136 case tryInPlayground
137+ case uptimeCheck
137138 case validateSPIManifest
138139
139140 var path : String {
@@ -254,6 +255,9 @@ enum SiteURL: Resourceable, Sendable {
254255 case . tryInPlayground:
255256 return " try-in-a-playground "
256257
258+ case . uptimeCheck:
259+ return " uptime-check "
260+
257261 case . validateSPIManifest:
258262 return " validate-spi-manifest "
259263 }
@@ -276,6 +280,7 @@ enum SiteURL: Resourceable, Sendable {
276280 . siteMapStaticPages,
277281 . supporters,
278282 . tryInPlayground,
283+ . uptimeCheck,
279284 . validateSPIManifest:
280285 return [ . init( stringLiteral: path) ]
281286
Original file line number Diff line number Diff line change @@ -128,6 +128,10 @@ func routes(_ app: Application) throws {
128128 app. get ( SiteURL . supporters. pathComponents, use: SupportersController . show) . excludeFromOpenAPI ( )
129129 }
130130
131+ do { // Uptime check
132+ app. get ( SiteURL . uptimeCheck. pathComponents, use: UptimeCheckController . show) . excludeFromOpenAPI ( )
133+ }
134+
131135 do { // spi.yml validation page
132136 app. get ( SiteURL . validateSPIManifest. pathComponents, use: ValidateSPIManifestController . show)
133137 . excludeFromOpenAPI ( )
You can’t perform that action at this time.
0 commit comments