Skip to content

Commit

Permalink
Fix duration deprecated usage (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhbd authored Jul 21, 2021
1 parent 5287d04 commit 3bc470d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/app/softwork/ratelimit/RateLimit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public class RateLimit(public val configuration: Configuration) {
is Block -> {
finish()
if (feature.configuration.sendRetryAfterHeader) {
call.response.header(HttpHeaders.RetryAfter, isAllowed.retryAfter.inSeconds.toLong())
call.response.header(HttpHeaders.RetryAfter, isAllowed.retryAfter.inWholeSeconds)
}
call.respond(HttpStatusCode.TooManyRequests)
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/app/softwork/ratelimit/RateLimitTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ suspend fun RateLimit.test(limit: Int, timeout: Duration) {
repeat(limit) {
assertTrue(isAllowed("a") is Block)
}
delay(timeMillis = timeout.toLongMilliseconds())
delay(timeMillis = timeout.inWholeMilliseconds)
assertEquals(Allow, isAllowed("a"))

repeat(limit) {
Expand All @@ -136,7 +136,7 @@ suspend fun RateLimit.test(limit: Int, timeout: Duration) {
}

repeat(limit * 2) {
delay(timeMillis = timeout.toLongMilliseconds())
delay(timeMillis = timeout.inWholeMilliseconds)
assertEquals(Allow, isAllowed("a"))
}
}

0 comments on commit 3bc470d

Please sign in to comment.