This is an automated email from the ASF dual-hosted git repository.

matthieu pushed a commit to branch refactorings-5
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 2af783f13fced56b358d470af0e82b82f4bc0ec7
Author: Matthieu Baechler <[email protected]>
AuthorDate: Fri Feb 10 09:03:14 2023 +0100

    Avoid some repetition
---
 .../org/apache/james/transport/mailets/GlobalRateLimit.scala      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/server/mailet/rate-limiter/src/main/scala/org/apache/james/transport/mailets/GlobalRateLimit.scala
 
b/server/mailet/rate-limiter/src/main/scala/org/apache/james/transport/mailets/GlobalRateLimit.scala
index c451f9c2a2..385ccd80fd 100644
--- 
a/server/mailet/rate-limiter/src/main/scala/org/apache/james/transport/mailets/GlobalRateLimit.scala
+++ 
b/server/mailet/rate-limiter/src/main/scala/org/apache/james/transport/mailets/GlobalRateLimit.scala
@@ -32,10 +32,10 @@ import org.reactivestreams.Publisher
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 case class GlobalKey(keyPrefix: Option[KeyPrefix], entityType: EntityType) 
extends RateLimitingKey {
-  val globalPrefix: String = "global"
-
-  override def asString(): String = keyPrefix.map(prefix => 
s"${prefix.value}_${entityType.asString}_$globalPrefix}")
-    .getOrElse(s"${entityType.asString}_$globalPrefix")
+  override val asString: String = {
+    val key = s"${entityType.asString}_global}"
+    keyPrefix.map(prefix => s"${prefix.value}_$key").getOrElse(key)
+  }
 }
 
 case class GlobalRateLimiter(rateLimiter: Option[RateLimiter], keyPrefix: 
Option[KeyPrefix], entityType: EntityType) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to