-
Notifications
You must be signed in to change notification settings - Fork 14
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
Setting a Default Request Timeout for REST API Calls #49
Conversation
Signed-off-by: hfuss <haydenfuss@gmail.com>
1 second does seem pretty aggressive. Is there a reason this particular value was chosen? |
@nguyer none really short of I expect DX's themselves to be quick w/ these responses so the real latency they experience should only be due to TLS handshakes, geography / speed of light, and load balancers / proxies in-between. I'd be alright something more like 2s - 10s if need be, just don't think it should be much longer than 10s. |
Signed-off-by: hfuss <haydenfuss@gmail.com>
Agree with the observation and the change that followed bumping the timeout from 1 to 5 seconds. Note that these calls are used not only for sending messages, but also for transferring files. On slow connections large size files could take several seconds to make it to the other side. We don't want to risk timing out the connection while files are being transfer. |
@gabriel-indik ah thanks Gabriel! Makes sense. In that case then I could even see us going up to 30s. Another option is we set this timeout differently for messages vs blobs using the request config. So messages could be 5s, but blobs 60s... thoughts? |
Signed-off-by: hfuss <haydenfuss@gmail.com>
That's a great idea, we could make the code adjust the timeout dynamically depending on the size of the payload to be transferred. But in principle, using 5 seconds as set in this PR I think is pretty safe for now. Unless someone wants to transfer a file that is over a hundred MB, we should be good. |
This worked as expected:
|
Testing FireFly DX in an env with a bad network, I noticed DX would "hang" for roughly 2m10s on each req attempt until
ETIMEDOUT
was thrown:According to axios/axios#1739 and https://axios-http.com/docs/req_config, setting this should make it so these reqs fail much more quickly.