From 1d9286169b6738ada1a0c74348c70f7d2029469b Mon Sep 17 00:00:00 2001 From: Dmitry Kisler Date: Tue, 28 Nov 2023 21:17:44 +0100 Subject: [PATCH] Add rate limits Signed-off-by: Dmitry Kisler --- src/internal/github/client.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/internal/github/client.go b/src/internal/github/client.go index f5a81cc068..b62679c0be 100644 --- a/src/internal/github/client.go +++ b/src/internal/github/client.go @@ -6,6 +6,7 @@ import ( "log/slog" "net/http" "os" + "time" "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/go-retryablehttp" @@ -51,10 +52,10 @@ func NewClient(ctx context.Context, log *slog.Logger, token string) Client { httpClient: retryClient, ghClient: githubv4.NewClient(httpClient), - cliThrottle: NewDummyThrottle(), - apiThrottle: NewDummyThrottle(), - assetThrottle: NewDummyThrottle(), - rssThrottle: NewDummyThrottle(), + cliThrottle: NewThrottle(ctx, time.Second/30, 30), + apiThrottle: NewThrottle(ctx, time.Second, 3), + assetThrottle: NewThrottle(ctx, time.Second/30, 30), + rssThrottle: NewThrottle(ctx, time.Second/30, 30), } /* TODO retryClient := retryablehttp.NewClient()