fix: missing rate limit setting for legacy store protocol (#2631)

This commit is contained in:
NagyZoltanPeter 2024-04-25 17:51:34 +02:00 committed by GitHub
parent 0b0fbfad5c
commit 5f65565c85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -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:

View File

@ -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())