Skip to content
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

Timeouts? #93

Open
laurencer opened this issue Oct 6, 2015 · 3 comments
Open

Timeouts? #93

laurencer opened this issue Oct 6, 2015 · 3 comments

Comments

@laurencer
Copy link

How does this library handle timeouts? I can't see anywhere to specify them (or whether there is an implicit default). Everything just goes from Connection -> Request -> IO a (or something like that) where neither Connection nor Request have any connection-level concerns (like timeouts).

Haxr depends on it for sending HTTP requests, and appears to be failing with timeouts when used from confluence-sync against a slow Confluence instance (> 5 second request latency).

Is there anything I'm missing in this library, or have I been lead down the wrong path by error messages somewhere in my stack?

@laurencer
Copy link
Author

So found the issue. Timeouts are set on the socket itself (not via io-streams).

By using network-socket-options (or alternatively just the plain Network.Socket interface), you can add in a couple of IO actions that set the timeouts.

For example (for the openConnection function).

    s <- socket f Stream defaultProtocol

    let timeoutMicros = 60000000 -- 60 seconds
    setRecvTimeout s timeoutMicros
    setSendTimeout s timeoutMicros

This also needs to be done for openConnectionSSL.

I haven't issued a pull request because I'm not sure how you want to expose access to the Socket or timeouts via the API. Any ideas @afcowie ?

@laurencer
Copy link
Author

@istathar
Copy link
Member

@laurencer Thanks for digging into this. I actually just fired up IRC to start asking around.

Exposing what was an internal detail to user configuration is a tough one. It's supposed to be in the domain of "just works", but this isn't the first time meddling with the connection code has come up. Timeout is a fairly pervasive concept, and we really ought to support adjusting it.

I'll have a look at a few of the other open issues and see if there's a common enough thread to justify an API smash. bbiab.

AfC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants