From 7c3f8b0af54429ef82bf7cb054c4d897247637e3 Mon Sep 17 00:00:00 2001 From: SOR <3272194354@qq.com> Date: Mon, 6 Jul 2026 13:52:00 +0800 Subject: [PATCH] refactor: useless toLong() --- .../com/github/sor2171/backend/filter/FlowLimitFilter.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/main/kotlin/com/github/sor2171/backend/filter/FlowLimitFilter.kt b/backend/src/main/kotlin/com/github/sor2171/backend/filter/FlowLimitFilter.kt index eb340de..01f8a7b 100644 --- a/backend/src/main/kotlin/com/github/sor2171/backend/filter/FlowLimitFilter.kt +++ b/backend/src/main/kotlin/com/github/sor2171/backend/filter/FlowLimitFilter.kt @@ -23,9 +23,9 @@ class FlowLimitFilter( @param:Value($$"${app.flow-limit.count}") private val limitCount: Int, @param:Value($$"${app.flow-limit.limit-time}") - private val limitTime: Int, + private val limitTime: Long, @param:Value($$"${app.flow-limit.ban-time}") - private val expireTime: Int, + private val expireTime: Long, ) : WebFilter { override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono { @@ -61,14 +61,14 @@ class FlowLimitFilter( if (count == 1L) { template.expire( counterKey, - Duration.ofSeconds(limitTime.toLong()) + Duration.ofSeconds(limitTime) ).thenReturn(true) } else if (count > limitCount) { template.opsForValue() .set( blockKey, "1", - Duration.ofSeconds(expireTime.toLong()) + Duration.ofSeconds(expireTime) ) .thenReturn(false) } else {