Closed mandrachek closed 3 weeks ago
So, haha, it looks like this should be doable with @ReqBuilder, ala:
@ReqBuilder builder: HttpRequestBuilder.() -> Unit = {
timeout {
requestTimeoutMillis = 60*60*1000
socketTimeoutMillis = 60*60*1000
}
},
Is your feature request related to a problem? Please describe.
I have APIs that download and upload files. Sometimes these files are large and take quite some time for upload/download depending on the client's network connection.
Describe the solution you'd like
Add @RequestTimeout(timeout: Long) and @SocketTimeout(timeout: Long) annotations that allow setting longer timeouts for specific api calls. (Using these would require you have the HttpTimeout plugin installed.)
Describe alternatives you've considered
setting high timeouts for all requests - this could potentially lead to the app being frozen waiting for a response to what should generally be quick API calls if there's network trouble.
creating multiple engine instances, multiple ktor instances, and multiple ktorfit api instances to handle different timeout needs - this is a lot of overhead.
Additional context
No response