From 5169341aa4f87b25130c7c967ce0325858a13f26 Mon Sep 17 00:00:00 2001 From: rishi-salunkhe-mettle Date: Tue, 30 Jul 2024 01:57:44 -0400 Subject: [PATCH 1/2] Increased the time delay between CHPL API Requests to 1.2 seconds --- endpointmanager/pkg/chplquerier/chplquerier.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endpointmanager/pkg/chplquerier/chplquerier.go b/endpointmanager/pkg/chplquerier/chplquerier.go index 6f00ca526..71ea24536 100644 --- a/endpointmanager/pkg/chplquerier/chplquerier.go +++ b/endpointmanager/pkg/chplquerier/chplquerier.go @@ -47,7 +47,7 @@ func makeCHPLURL(path string, queryArgs map[string]string, pageSize int, pageNum func getJSON(ctx context.Context, client *http.Client, chplURL *url.URL, userAgent string) ([]byte, error) { // request ceritified products list // Adds a short delay between request - time.Sleep(time.Duration(500 * time.Millisecond)) + time.Sleep(time.Duration(1200 * time.Millisecond)) req, err := http.NewRequest("GET", chplURL.String(), nil) if err != nil { return nil, errors.Wrap(err, "creating http request failed") From 586625c8d5296e89dfb9f1cc2e6f15d35c1f8a8f Mon Sep 17 00:00:00 2001 From: rishi-salunkhe-mettle Date: Thu, 1 Aug 2024 15:36:49 -0400 Subject: [PATCH 2/2] Added a comment explaining the code change --- endpointmanager/pkg/chplquerier/chplquerier.go | 1 + 1 file changed, 1 insertion(+) diff --git a/endpointmanager/pkg/chplquerier/chplquerier.go b/endpointmanager/pkg/chplquerier/chplquerier.go index 71ea24536..eac961fb2 100644 --- a/endpointmanager/pkg/chplquerier/chplquerier.go +++ b/endpointmanager/pkg/chplquerier/chplquerier.go @@ -47,6 +47,7 @@ func makeCHPLURL(path string, queryArgs map[string]string, pageSize int, pageNum func getJSON(ctx context.Context, client *http.Client, chplURL *url.URL, userAgent string) ([]byte, error) { // request ceritified products list // Adds a short delay between request + // LANTERN-721: Increased the delay to 1.2 seconds since the CHPL API rate limit is one request per second time.Sleep(time.Duration(1200 * time.Millisecond)) req, err := http.NewRequest("GET", chplURL.String(), nil) if err != nil {