From f16313e9e05a9d291bb40dc261e1ca744e909076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Wed, 31 Jul 2024 17:25:46 +0200 Subject: [PATCH] disable rate limiting for local network --- testnet/launcher/docker.go | 1 + testnet/launcher/gateway/config.go | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/testnet/launcher/docker.go b/testnet/launcher/docker.go index b92936caea..61c9d60603 100644 --- a/testnet/launcher/docker.go +++ b/testnet/launcher/docker.go @@ -191,6 +191,7 @@ func (t *Testnet) Start() error { gateway.WithTenNodeHTTPPort(13010), gateway.WithTenNodeWSPort(13011), gateway.WithTenNodeHost("validator-host"), + gateway.WithRateLimitUserComputeTime(0), // disable rate limiting for local network gateway.WithDockerImage("testnetobscuronet.azurecr.io/obscuronet/obscuro_gateway:latest"), ), ) diff --git a/testnet/launcher/gateway/config.go b/testnet/launcher/gateway/config.go index 507d5e6a19..bd72fc318b 100644 --- a/testnet/launcher/gateway/config.go +++ b/testnet/launcher/gateway/config.go @@ -1,16 +1,19 @@ package gateway +import "time" + // Option is a function that applies configs to a Config Object type Option = func(c *Config) // Config holds the properties that configure the package type Config struct { - tenNodeHost string - tenNodeHTTPPort int - tenNodeWSPort int - gatewayHTTPPort int - gatewayWSPort int - dockerImage string + tenNodeHost string + tenNodeHTTPPort int + tenNodeWSPort int + gatewayHTTPPort int + gatewayWSPort int + rateLimitUserComputeTime time.Duration + dockerImage string } func NewGatewayConfig(opts ...Option) *Config { @@ -58,3 +61,9 @@ func WithGatewayWSPort(i int) Option { c.gatewayWSPort = i } } + +func WithRateLimitUserComputeTime(d time.Duration) Option { + return func(c *Config) { + c.rateLimitUserComputeTime = d + } +}