aws

steveb8n 2024-06-16T08:38:22.318859Z

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

jumar 2024-06-16T06:21:54.523859Z

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

jumar 2024-06-16T08:15:26.897619Z

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.

jumar 2024-06-16T08:16:43.979879Z

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?

steveb8n 2024-06-16T08:17:37.800489Z

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

jumar 2024-06-16T08:19:07.866639Z

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

jumar 2024-06-16T08:28:00.403499Z

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 😮

steveb8n 2024-06-16T08:35:10.712949Z

Yep. Use :http-client option when creating client

jumar 2024-06-16T08:36:08.820569Z

I also found this: https://github.com/cognitect-labs/aws-api/issues/41

jumar 2024-06-16T08:41:07.315889Z

(unfortunately, no progress in 5 years 😞 )

steveb8n 2024-06-16T08:42:31.163199Z

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

jumar 2024-06-16T09:34:44.713369Z

That just doesn’t make sense to me. It’s overly complicated and doesn’t address the problem properly (setting timeouts on network sockets)

steveb8n 2024-06-16T09:53:57.776039Z

Ok. The other option is no cognitect wrapper but instead interop with AWS java API. That will have a alternative client timeout to explore

steveb8n 2024-06-16T09:54:30.657009Z

After that, I'm out of ideas

steveb8n 2024-06-16T06:44:36.930959Z

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