In case of network problems, time out after 5 seconds instead of relying on OS
to close the connection which can take more than 20 minutes. Timeout value is
measured between successfully transmitted packets, not for entire transaction.
So we don't require big files to be downloaded in 5 seconds but we require not
to get stuck for more than 5 seconds.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvmbisect/llvmlab/gcs.py | ||
---|---|---|
15 ↗ | (On Diff #116681) | Maybe we should call this HttpSession to emphasize that we will need a new instance each time? |
llvmbisect/llvmlab/gcs.py | ||
---|---|---|
15 ↗ | (On Diff #116681) | In this code it doesn't really matter if you create a new instance or reuse the old one. In most places I decided to create a new instance because it is simpler. I've chosen name HttpClient because client.get(...) seems more natural compared to session.get(...). I have to acknowledge my preferences are influenced by Java (e.g. org.apache.http.impl.client.CloseableHttpClient, okhttp3.OkHttpClient). Though looks like in Python "client" is also popular according to renaming httplib to http.client. |
llvmbisect/llvmlab/gcs.py | ||
---|---|---|
53 ↗ | (On Diff #116681) | No argument against it. I'll move and test. HttpClient was intended to be stateful so I tried to avoid sharing. But based on current implementation we can safely share it and if necessary, it is possible to have a separate client. |