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

Allow maximum request timeout to be larger than write timeout (avoid EOF) #31

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

peterbroadhurst
Copy link
Contributor

The WriteTimeout in Go is actually the time all the way from the reading of the headers, until the data has been fully written in the response.

In an example E2E test with confirmations, so that synchronous calls take longer than 15s to complete, we see:

Websocket 127.0.0.1:5000 event: default/token_pool_confirmed/339d3f53-37de-4baa-bd46-e4277aeb315e -> c4a76e57-d586-4cbf-9581-b0deb5352ec4 (tx=%!s(*core.Transaction=<nil>))
    restclient.go:552: 
                Error Trace:    /Users/pbroadhurst/dev/firefly/firefly/test/e2e/runners/restclient.go:552
                                                        /Users/pbroadhurst/dev/firefly/firefly/test/e2e/runners/tokens.go:231
                Error:          Received unexpected error:
                                Post "http://127.0.0.1:5000/api/v1/namespaces/default/tokens/pools?confirm=true": EOF
                Test:           TestEthereumMultipartyE2ESuite/TestE2ENonFungibleTokensSync

This PR allows the constructor of the HTTP Server to include a MaximumRequestTimeout, which forces the read timeout and the write timeout (not the read header timeout) to be larger than this value.

It adds 1 second buffer, so that a nice error message can be returned in the case of a context based request timeout.

… EOFs

Signed-off-by: Peter Broadhurst <peter.broadhurst@kaleido.io>
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

Successfully merging this pull request may close these issues.

2 participants