From 0853d87fc387b268ecc361c0a40ade34d6c6ff27 Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Wed, 18 May 2022 10:34:56 +0300 Subject: [PATCH] rate limiter now enabled from config --- main.go | 2 +- tests/load.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 9252854..ff3a06e 100644 --- a/main.go +++ b/main.go @@ -54,7 +54,7 @@ func main() { isDev := c.IsFromLocal() path := c.Path() isRequestForStatic := strings.Contains(path, "/static") || strings.Contains(path, "/uploads") || strings.Contains(path, "/captcha") - return isRequestForStatic || isDev + return (isRequestForStatic || isDev) && config.App.IsRateLimiterEnabled }, Max: 50, })) diff --git a/tests/load.sh b/tests/load.sh index bdb4061..696961e 100755 --- a/tests/load.sh +++ b/tests/load.sh @@ -1,4 +1,4 @@ - echo "GET http://localhost:3000" | vegeta attack -rate 100 -duration=120s | tee results.bin | vegeta report + echo "GET http://micrach.igonin.dev" | vegeta attack -rate 100 -duration=120s | tee results.bin | vegeta report # vegeta report -type=json results.bin > metrics.json cat results.bin | vegeta plot > plot.html open plot.html