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

Allow client function to wait then retry after an error via purrr? #20

Open
PietrH opened this issue Mar 13, 2023 · 2 comments · May be fixed by inbo/etn#271
Open

Allow client function to wait then retry after an error via purrr? #20

PietrH opened this issue Mar 13, 2023 · 2 comments · May be fixed by inbo/etn#271
Labels
client-side enhancement New feature or request

Comments

@PietrH
Copy link
Member

PietrH commented Mar 13, 2023

On the client side, API calling code could be wrapped in:

purrr::insistently(f, rate = purrr::rate_backoff(), quiet = TRUE)

Docs:

Currently postman tests mostly fail because the 3s deadline is not met, however, on occasion other error codes are returned. These need to be captured client side and translated in clear error messages for the user, but before it comes this far, it would be beneficial if the function would try again (perhaps with a notification that this is being attempted).

The most pragmatic solution to me is on the client side, via purrr, as above. However, a server side solution could be possible where the server waits for confirmation from the client that the response is satisfactory. But I think this is adding unnecessary additional complexity and server load, as two subsequent queries to ETN should deliver the same result except in extreme edge cases where data is being edited between the two calls.

See also: two general's problem

In any case, this is an additional argument to minimize the time it takes to return a query as well as package size.

@PietrH PietrH added enhancement New feature or request client-side labels Mar 13, 2023
@PietrH PietrH linked a pull request Jun 9, 2023 that will close this issue
34 tasks
@PietrH
Copy link
Member Author

PietrH commented May 3, 2024

Switching to httr2 and using req_retry() is a better idea

@PietrH
Copy link
Member Author

PietrH commented May 3, 2024

Maybe a good idea when I migrate from httr to httr2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-side enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant