Skip to content

Request retry #63

@zekroTJA

Description

@zekroTJA

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions