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

Request retry #63

Open
zekroTJA opened this issue Jun 11, 2024 · 0 comments
Open

Request retry #63

zekroTJA opened this issue Jun 11, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@zekroTJA
Copy link
Member

It should be possible to re-try a request when a certain condition mets. This can be particularly useful when an action is performed asynchronously - like processing a video, in example.

A request retry could be triggered by a special function callable in the [Script] section. Also, there could be an option to define the maximum amount of retries.

GET https://{{.instance}}/processing/status

[Options]
max-retries = 20

[Script]
assert(response.StatusCode === 200);
if (response.Body.status === "processing" && retry(2000)) {
  return;
}
assert(response.Body.Status === "finished");

The retry function could have the following signature.

function retry(in_ms?: number): boolean;

in_ms defines a duration which is awaited before the next retry. The function returns a boolean which is true, when a next retry will occur. Otherwise, the function will return false, when no further retry will be scheduled. This can occur when max-retries has reached, in example.

@zekroTJA zekroTJA added the enhancement New feature or request label Jun 11, 2024
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

No branches or pull requests

1 participant