Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cullenmcdermott
Copy link
Contributor

Hi! Thanks for this library. I'm currently using it in https://github.com/cullenmcdermott/terraform-provider-porkbun and someone reported they were hitting rate limits from Porkbun.

I was having trouble parsing the error out so I've made some updates to return a custom error and to tell us if it should be retryable or not. I haven't added additional tests for this but I'm happy to if you'd like.

@ldez ldez added the enhancement New feature or request label Dec 31, 2022
@ldez
Copy link
Member

ldez commented Dec 31, 2022

In summary, I'm ok with a typed error but the "retryable" part should be removed.

@ldez
Copy link
Member

ldez commented Dec 31, 2022

Can you give me an example of the response body related to the rate limit?
Can you add a test?

@cullenmcdermott
Copy link
Contributor Author

Running this command:

while true; do curl --fail -i --data @secret.json https://porkbun.com/api/json/v3/ping; done

secret.json just contains my apikey and secretapikey.

Returns this on the 3rd or 4th loop

HTTP/2 503 
date: Sun, 08 Jan 2023 00:04:24 GMT
content-type: text/html
content-length: 194
set-cookie: AWSALB=foobar; Expires=Sun, 15 Jan 2023 00:04:24 GMT; Path=/
set-cookie: AWSALBCORS=foobar; Expires=Sun, 15 Jan 2023 00:04:24 GMT; Path=/; SameSite=None; Secure
server: openresty
strict-transport-security: max-age=63072000; includeSubDomains; preload
x-frame-options: deny

curl: (22) The requested URL returned error: 503

I'm going to work on a test at some point this weekend hopefully.

@cullenmcdermott

This comment was marked as off-topic.

@ldez ldez force-pushed the return-custom-error branch from 6b61c7b to 027001a Compare January 15, 2023 12:47
@ldez ldez force-pushed the return-custom-error branch from 54b69b4 to 982b91c Compare January 15, 2023 12:56
@ldez ldez force-pushed the return-custom-error branch from ee89bc8 to 18d9dd6 Compare January 15, 2023 13:08
@ldez ldez changed the title Return custom error and check if its retryable Return custom error Jan 15, 2023
Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ldez ldez changed the title Return custom error feat: return custom error Jan 18, 2023
@ldez ldez merged commit fb8cb92 into nrdcg:master Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants