-
Notifications
You must be signed in to change notification settings - Fork 144
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
feat(wallet): add timeout client connection #1396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this work in GUI wallet as well?
@Ja7ad I've tested it manually with 1 second as timeout but it took 24 seconds to respond to me. My command: ./pactus-wallet address balance pc1zvchrej8nwfgvsduw47r4qmss5u25kvls2fx8e6 --timeout 1 Shouldn't it return a timeout error? |
This timeout duration for dialing client, gRPC client is immediately and connecting the server happens in background. When call If server got timeout, try to create new client with other servers. |
@Ja7ad So, with only 7 servers, and 1-second timeout after 7 seconds I have to get data or timeout or can't connect to servers. Here is the servers list: "mainnet": [
"localhost:50051",
"bootstrap1.pactus.org:50051",
"bootstrap2.pactus.org:50051",
"bootstrap3.pactus.org:50051",
"bootstrap4.pactus.org:50051",
"65.109.234.125:50051",
"157.90.111.140:50051"
] But it took 24 seconds in my case, am I wrong? The main thing: we are applying timeout on each request or only when we connect to a server? |
This timeout is when dialing not query. You connected to 1 server before 1 second timeout, but this server have delay on query. |
@Ja7ad our goal is to reduce the latency or just get a timeout. what do you think if we apply the timeout to queries as well? as we defined it on Trello task? The rest looks good to me, we can merge it. |
Our delay is on when dialing to find the best server, in connect function. |
@Ja7ad but based on my manual test, the process is still slow but there is no timeout error. which is not the same as our goal. |
@b00f done |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1396 +/- ##
==========================================
- Coverage 77.16% 76.42% -0.74%
==========================================
Files 233 213 -20
Lines 11941 10978 -963
==========================================
- Hits 9214 8390 -824
+ Misses 2305 2196 -109
+ Partials 422 392 -30 |
Description
This PR introduces a client timeout for connections when dialing to the server. The primary goal is to prevent delays during query retrieval by setting a maximum duration for establishing a connection. This ensures that if a server is unresponsive or slow, the client will not hang indefinitely, thereby improving the overall responsiveness and reliability of the application.