diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 57f71f7..c689ed6 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -2,11 +2,9 @@ name: genkai CI on: pull_request: - branches: - - master + branches: ['*'] push: - branches: - - master + branches: ['*'] jobs: scalafmt: diff --git a/modules/redis/common/src/main/scala/genkai/redis/RedisStrategy.scala b/modules/redis/common/src/main/scala/genkai/redis/RedisStrategy.scala index c499714..ac94b2c 100644 --- a/modules/redis/common/src/main/scala/genkai/redis/RedisStrategy.scala +++ b/modules/redis/common/src/main/scala/genkai/redis/RedisStrategy.scala @@ -69,7 +69,7 @@ object RedisStrategy { private val argsPart = List( underlying.tokens.toString, underlying.refillAmount.toString, - underlying.refillDelay.toMillis.toString + underlying.refillDelay.toSeconds.toString ) override val acquireLuaScript: String = LuaScript.tokenBucketAcquire @@ -80,10 +80,10 @@ object RedisStrategy { List(s"token_bucket:${Key[A].convert(value)}") override def permissionsArgs(instant: Instant): List[String] = - instant.toEpochMilli.toString :: argsPart + instant.getEpochSecond.toString :: argsPart override def acquireArgs(instant: Instant, cost: Long): List[String] = - instant.toEpochMilli.toString :: cost.toString :: argsPart + instant.getEpochSecond.toString :: cost.toString :: argsPart override def isAllowed(value: Long): Boolean = value != 0 @@ -105,7 +105,7 @@ object RedisStrategy { override def keys[A: Key](value: A, instant: Instant): List[String] = { - val ts = instant.truncatedTo(underlying.window.unit).toEpochMilli + val ts = instant.truncatedTo(underlying.window.unit).getEpochSecond List(s"fixed_window:${Key[A].convert(value)}:$ts") } @@ -141,10 +141,10 @@ object RedisStrategy { ) override def permissionsArgs(instant: Instant): List[String] = - instant.toEpochMilli.toString :: permissionArgsPart + instant.getEpochSecond.toString :: permissionArgsPart override def acquireArgs(instant: Instant, cost: Long): List[String] = - instant.toEpochMilli.toString :: cost.toString :: acquireArgsPart + instant.getEpochSecond.toString :: cost.toString :: acquireArgsPart override def isAllowed(value: Long): Boolean = value != 0