Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-WebRequest from JiraPS does not use MaximumRetryCount #505

Open
IonutDanNica opened this issue Jan 31, 2024 · 0 comments
Open

Invoke-WebRequest from JiraPS does not use MaximumRetryCount #505

IonutDanNica opened this issue Jan 31, 2024 · 0 comments

Comments

@IonutDanNica
Copy link

Context

Is your feature request related to a problem? Please describe.

I work with a Jira instance that has really low API limits - 50 requests and 10 new requests per minute, so I was thinking maybe it was possible to use MaximumRetryCount parameter from Invoke-Webrequest to retry the request.
The native powershell Invoke-webrequest has support for this since version 7.4, but the IWR function inside jiraPS does not have this as a usable parameter.

Description

Describe the solution you'd like

Is it possible to:
1 - drop the use of a custom IWR (not sure if this was for historical reasons or otherwise) if using powershell core or newer
2 - adjust the IWR function to accept newer supported parameters from native Powershell IWR so that JiraPS can properly throttle itself
3 - Add some sort of timer to retry the IWR command either after "x-RateLimit-Interval-Seconds" that is sent with every webresponse header or via some sort of loop, to retry until 'retry-after' from headers is zero.

Additional Information

The rate information as per Atlassian official docs:

When users make authenticated requests, they’ll see rate limiting headers in the response. These headers are added to every response, not just when you’re rate limited.
Header Description
X-RateLimit-Limit The maximum number of requests (tokens) you can ever have. New tokens won’t be added to your bucket after reaching this limit. Your admin configures this as Max requests.
X-RateLimit-Remaining The remaining number of tokens. This is what you have and can use right now.
X-RateLimit-Interval-Seconds The time interval in seconds. You get a batch of new tokens every such time interval.
X-RateLimit-FillRate The number of tokens you get every time interval. Your admin configures this as __ Requests allowed.
retry-after How long you need to wait until you get new tokens.
You can send a request successfully when the retry-after header is set to 0 after several failures with the HTTP status code 429.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant