Fork me on GitHub
#aws
<
2024-06-16
>
jumar06:06:54

For aws-api, (how) can I specify http timeouts? Are there any defaults?

steveb8n06:06:36

Using the core.async API you can use alts and timeout channels to implement client timeout

jumar08:06:26

Well, I would really like to avoid core.async API. Besides, that doesn't set proper network socket timeouts, which is what I want to do.

jumar08:06:43

I found :timeout-msec option for HttpClient protocol https://github.com/cognitect-labs/aws-api/blob/1a27e1e466e2f999cdd00d1738426f3d3c68e1e9/src/cognitect/aws/http.clj#L26 Would I need to implement my own http client?

steveb8n08:06:37

There's probably a timeout in the bundled http client you can use also

jumar08:06:07

I'm afraid I don't know how to specify/use that.

jumar08:06:00

My best guess is that I would have to create my own instance via cognitect.http-client/create and pass the expected timeouts. https://github.com/tobias/cognitect-http-client/blob/main/src/cognitect/http_client.clj#L318-L319 look sensible; however I don't see the :socket-timeout option 😮

steveb8n08:06:10

Yep. Use :http-client option when creating client

jumar08:06:07

(unfortunately, no progress in 5 years 😞 )

steveb8n08:06:31

You could I interpret that as indicating that core.async is how you customise client

jumar08:06:00

My best guess is that I would have to create my own instance via cognitect.http-client/create and pass the expected timeouts. https://github.com/tobias/cognitect-http-client/blob/main/src/cognitect/http_client.clj#L318-L319 look sensible; however I don't see the :socket-timeout option 😮

steveb8n08:06:22

Yeah they aren't treating http client as a fully baked API. We are using core Async API for timeouts. Works well. You can always do blocking read from core Async API so convert back to blocking with timeout