mirror of https://github.com/waku-org/nwaku.git
fix: missing rate limit setting for legacy store protocol (#2631)
This commit is contained in:
parent
0b0fbfad5c
commit
5f65565c85
|
@ -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:
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue