From 5f65565c85d1b5ef8034a2190714d30ca2d2ab8c Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:51:34 +0200 Subject: [PATCH] fix: missing rate limit setting for legacy store protocol (#2631) --- waku/common/ratelimit.nim | 3 ++- waku/factory/node_factory.nim | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/waku/common/ratelimit.nim b/waku/common/ratelimit.nim index 4e6ba52c6..107eee5ad 100644 --- a/waku/common/ratelimit.nim +++ b/waku/common/ratelimit.nim @@ -11,7 +11,8 @@ export tokenbucket type RateLimitSetting* = tuple[volume: int, period: Duration] -let DefaultGlobalNonRelayRateLimit*: RateLimitSetting = (60, 1.minutes) +# Set the default to switch off rate limiting for now +let DefaultGlobalNonRelayRateLimit*: RateLimitSetting = (0, 0.minutes) proc newTokenBucket*(setting: Option[RateLimitSetting]): Option[TokenBucket] = if setting.isNone: diff --git a/waku/factory/node_factory.nim b/waku/factory/node_factory.nim index 638e3df29..905f4b831 100644 --- a/waku/factory/node_factory.nim +++ b/waku/factory/node_factory.nim @@ -244,15 +244,15 @@ proc setupProtocols( return err("failed to mount waku archive protocol: " & mountArcRes.error) # Store setup + let rateLimitSetting: RateLimitSetting = + (conf.requestRateLimit, chronos.seconds(conf.requestRatePeriod)) try: - let rateLimitSetting: RateLimitSetting = - (conf.requestRateLimit, chronos.seconds(conf.requestRatePeriod)) await mountStore(node, rateLimitSetting) except CatchableError: return err("failed to mount waku store protocol: " & getCurrentExceptionMsg()) try: - await mountLegacyStore(node) + await mountLegacyStore(node, rateLimitSetting) except CatchableError: return err("failed to mount waku legacy store protocol: " & getCurrentExceptionMsg())