From 5bf55740bef5e8993f9a49724f2a74ea72d50768 Mon Sep 17 00:00:00 2001 From: Akmal Date: Thu, 27 Jun 2024 06:38:39 +0700 Subject: [PATCH] Remove grid rate limit --- go.mod | 2 -- go.sum | 6 ------ handlers/grid.go | 3 --- 3 files changed, 11 deletions(-) diff --git a/go.mod b/go.mod index ab90968..cd8535e 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,6 @@ require ( github.com/tidwall/gjson v1.17.1 github.com/valyala/bytebufferpool v1.0.0 github.com/valyala/fasthttp v1.55.0 - go.uber.org/ratelimit v0.3.1 golang.org/x/net v0.26.0 ) @@ -24,7 +23,6 @@ require ( github.com/DataDog/zstd v1.5.5 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/andybalholm/cascadia v1.3.2 // indirect - github.com/benbjohnson/clock v1.3.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cockroachdb/errors v1.11.3 // indirect diff --git a/go.sum b/go.sum index 40bb002..54893bd 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,6 @@ github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsVi github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU= github.com/ansrivas/fiberprometheus/v2 v2.6.1 h1:wac3pXaE6BYYTF04AC6K0ktk6vCD+MnDOJZ3SK66kXM= github.com/ansrivas/fiberprometheus/v2 v2.6.1/go.mod h1:MloIKvy4yN6hVqlRpJ/jDiR244YnWJaQC0FIqS8A+MY= -github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= -github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -127,10 +125,6 @@ github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7Fw github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/ratelimit v0.3.1 h1:K4qVE+byfv/B3tC+4nYWP7v/6SimcO7HzHekoMNBma0= -go.uber.org/ratelimit v0.3.1/go.mod h1:6euWsTB6U/Nb3X++xEUXA8ciPJvr19Q/0h1+oDcJhRk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= diff --git a/handlers/grid.go b/handlers/grid.go index 8d29ff4..3c1d722 100644 --- a/handlers/grid.go +++ b/handlers/grid.go @@ -15,7 +15,6 @@ import ( "git.sr.ht/~jackmordaunt/go-libwebp/webp" "github.com/gofiber/fiber/v2" gim "github.com/ozankasikci/go-image-merge" - "go.uber.org/ratelimit" ) var transport = &http.Transport{ @@ -28,7 +27,6 @@ var transport = &http.Transport{ DisableKeepAlives: true, } var timeout = 10 * time.Second -var rl = ratelimit.New(1) func Grid() fiber.Handler { return func(c *fiber.Ctx) error { @@ -134,7 +132,6 @@ func Grid() fiber.Handler { } // Write grid to static folder - rl.Take() // Rate limit, trying to avoid high CPU usage f, err := os.Create(gridFname) if err != nil { return c.SendStatus(fiber.StatusInternalServerError)