Skip to content

Commit b6346a4

Browse files
committed
Add a write-read test
1 parent ee29b7b commit b6346a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/App/configure.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ public func configure(_ app: Application) async throws -> String {
8181
// Setup Redis connection
8282
do {
8383
app.redis.configuration = try RedisConfiguration(hostname: "redis")
84+
do { // write-read test across nodes
85+
let key = "startup-time-\(app.http.server.configuration.hostname)"
86+
try await app.redis.set(.init(key), to: "\(Date.now)").get()
87+
if let value = try await app.redis.get(.init(key), as: String.self).get() {
88+
app.logger.info("Redis set/get result: \(value)")
89+
}
90+
}
8491
} catch {
8592
app.logger.warning("Failed to configure Redis, caching disabled. Error: \(error)")
8693
}

0 commit comments

Comments
 (0)