You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/04/26 06:13:05 UTC

[james-project] 05/09: Avoid some repetition

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

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

commit f51addb539d755569135c03eb14d0bc0bb678482
Author: Matthieu Baechler <ma...@baechler-craftsmanship.fr>
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 cf19976483..4ea602fa6d 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
@@ -31,10 +31,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: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org