Skip to content

Commit 9a3da19

Browse files
committed
Fix compile errors
1 parent 20cf239 commit 9a3da19

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/App/Core/RateCatcherMiddleware.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ final class RateCatcherMiddleware: AsyncMiddleware {
2626
let seconds: Int = Int(Date().timeIntervalSince1970)
2727
let combinedKey: RedisKey = "\(cfray):\(seconds)"
2828

29-
let countOverWindow: Int = try await request.redis.increment(combinedKey)
29+
var countOverWindow: Int = try await request.redis.increment(combinedKey).get()
3030
for i in seconds - windowSize ..< seconds {
3131
let key: RedisKey = "\(cfray):\(i)"
32-
countOverWindow += try await request.redis.get(key, as: Int.self)
32+
if let value = try await request.redis.get(key, as: Int.self).get() {
33+
countOverWindow += value
34+
}
3335
}
3436

3537
if countOverWindow > 999 {

0 commit comments

Comments
 (0)