From 2f5e02f42fb8f2b1271c8f87888db7234b3a5b5a Mon Sep 17 00:00:00 2001 From: Rucheli Berry <7971632+cmrberry@users.noreply.github.com> Date: Tue, 7 Jun 2022 11:27:56 -0700 Subject: [PATCH] remove 429 check on user, vendor, schedule --- pagerduty/data_source_pagerduty_schedule.go | 12 ++++-------- pagerduty/data_source_pagerduty_user.go | 12 ++++-------- pagerduty/data_source_pagerduty_vendor.go | 12 ++++-------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/pagerduty/data_source_pagerduty_schedule.go b/pagerduty/data_source_pagerduty_schedule.go index ef6dafedc..2d6615b7f 100644 --- a/pagerduty/data_source_pagerduty_schedule.go +++ b/pagerduty/data_source_pagerduty_schedule.go @@ -40,14 +40,10 @@ func dataSourcePagerDutyScheduleRead(d *schema.ResourceData, meta interface{}) e return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.Schedules.List(o) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.Schedule diff --git a/pagerduty/data_source_pagerduty_user.go b/pagerduty/data_source_pagerduty_user.go index cb94a7661..d32b8fd94 100644 --- a/pagerduty/data_source_pagerduty_user.go +++ b/pagerduty/data_source_pagerduty_user.go @@ -44,14 +44,10 @@ func dataSourcePagerDutyUserRead(d *schema.ResourceData, meta interface{}) error return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, err := client.Users.ListAll(o) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.FullUser diff --git a/pagerduty/data_source_pagerduty_vendor.go b/pagerduty/data_source_pagerduty_vendor.go index 8b6dae810..1d3d6804c 100644 --- a/pagerduty/data_source_pagerduty_vendor.go +++ b/pagerduty/data_source_pagerduty_vendor.go @@ -45,14 +45,10 @@ func dataSourcePagerDutyVendorRead(d *schema.ResourceData, meta interface{}) err return resource.Retry(5*time.Minute, func() *resource.RetryError { resp, _, err := client.Vendors.List(o) if err != nil { - if isErrCode(err, 429) { - // Delaying retry by 30s as recommended by PagerDuty - // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit - time.Sleep(30 * time.Second) - return resource.RetryableError(err) - } - - return resource.NonRetryableError(err) + // Delaying retry by 30s as recommended by PagerDuty + // https://developer.pagerduty.com/docs/rest-api-v2/rate-limiting/#what-are-possible-workarounds-to-the-events-api-rate-limit + time.Sleep(30 * time.Second) + return resource.RetryableError(err) } var found *pagerduty.Vendor