Kong / unirest-java

Unirest in Java: Simplified, lightweight HTTP client library.
http://kong.github.io/unirest-java/
MIT License
2.59k stars 593 forks source link

Retry #397

Closed SudoDios closed 3 years ago

SudoDios commented 3 years ago

hi. how to set retryOnConnectionFailure?

ryber commented 3 years ago

They are on by default but you can turn them off with Unirest.config().automaticRetries(false).

By default Unirest will automatically retry up to 5 times those methods that fail with a transport exception while the HTTP request is still being transmitted to the target server (i.e. the request has not been fully transmitted to the server).

SudoDios commented 3 years ago

Thanks ❤️

SudoDios commented 3 years ago

Do I just have to do this before each request ?

ryber commented 3 years ago

no, it's a configuration, you do it once for the instance (or the primary static instance if you are just using Unirest.config(). Don't do it on each request because it rebuilds the engine which is costly.

SudoDios commented 3 years ago

Thank you. I will follow you.

ryber commented 3 years ago

Looks like this is resolved. closing the issue