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

Changes and clarification of the close connection api #2

Closed
gospider007 opened this issue Nov 14, 2023 · 0 comments
Closed

Changes and clarification of the close connection api #2

gospider007 opened this issue Nov 14, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@gospider007
Copy link
Owner

gospider007 commented Nov 14, 2023

The official client.CloseIdleConnections() function is to close idle connections without affecting the connections in use.
The function of client.CloseConns() is to close all connections, wait for the connection in use and then close it.
client.ForceCloseConns() will force close all connections immediately, even if it is in use

client.CloseIdleConnections()  => client.CloseConns()
client.CloseConnections()  => client.ForceCloseConns()

The function of response.CloseBody() is to close the body. For streaming requests, the connection will be closed at the same time, such as: websocket, sse, stream=true
The function of response.CloseConn() is to close the connection. For the connection in use, wait for it to be closed after completion.
The function of response.ForceCloseConns() is to forcefully close the connection. The connection will be closed immediately even if it is in use.

response.Close() => response.CloseBody()
response.Delete() => response.CloseConn()
response.ForceDelete() => response.ForceCloseConn()
@gospider007 gospider007 added the documentation Improvements or additions to documentation label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant