-
Notifications
You must be signed in to change notification settings - Fork 522
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
Retry / Poll behaviour for asynchronous systems #525
Comments
This is a very good use case. We can't do it right now, but it would be interesting to support it. |
I thought it would have been pretty easy to just include a flag to curl::easy. But there is no --retry option there while its present in the cli tool. So quit a bit more work, it needs to be reimplemented somewhere. When reading the docs for the curl cli it also only retries on 5xx. I would have needed it to retry on 404. |
Hi @Goffen, I think we could address your use case with Hurl syntax (and also other asynchronous use case). We have asserts and captures on response, we could introduce a "retry" section on request that will retry the request if there is any failed asserts or fails captures. For instance: you create a resource, it give you an id and you want to pull this new created resource until a certain condition is met:
=> we create a resource (POST ...), we capture the id of the new resource, we pull the new resource until the status is DONE. Another user case:
=> Retry indefinitely until the status code is 200 Also:
=> Retry indefinitely with a 10s delay until the response contains an HTML element with id "bar". It's not exactly the curl "retry", we reuse the existing asserts and captures on headers, body, status etccc to define a criteria for the retry. Given this syntax/behaviour, do you think you can address your needs? |
Yes! That would have been awesome! Async-behaviour of fetching a collection as the result of a POST. Not exactly failing each fetch with 404 but instead not contained in the list.
(maybe not correct HURL syntax above, but..) Somewhere in the response of jobs we wait for the id to show up. |
Hi, 1 thing to keep in mind, is to be able to define a retry globally, for all cases, instead of having to set it for each request. For example, in Karate you can say that if you retry, it uses the global retry settings (https://github.com/karatelabs/karate#retry-until) This allows not having to give a delay and a count. |
Hi @Jiehong very good idea. We already have a per request model and a global option, for basic authentification:
Authentification can be added to every request of a file:
Or per request:
We could use the same model with this Thanks for the idea! |
We also plan to provide most of the curl options to Hurl. |
Update on this issue: a draft PR is in progress that should be landing for Hurl 1.8.0 (next version). The retry syntax is going to benefit form the We're going to have two new features:
This will allow this kind of Hurl file:
Or simply:
|
That's awesome! |
@jcamiel : thanks a lot, maybe just a word in the README for documentation purposes, and it'll be close to perfect <3 |
@Jiehong Thanks, I need to make a few things to complete the feature:
|
Hi there! I really like this project, but I cannot use it currently on my work because of a missing feature: to be able to retry a request.
My scenario is this:
We post in something that will eventually create something. Then I would like to poll for it to be present. After a certain amount of time I would declare it failed.
Is this something that would fit within Hurl?
The text was updated successfully, but these errors were encountered: