Optional attributes:
* *connect-timeout*: Timeout (in ms) for network connection. The default is 100.
+* *keep-alive*: If *true*, keep the HTTP connection to the storage server open
+to avoid reconnects. The default is *false*.
++
+NOTE: Connection keep-alive is disabled by default because with the current
+HTTP implementation uploads to the remote end might fail in case the server
+closes the connection due to a keep-alive timeout. If the general case with
+short compilation times should be accelerated or the server is configured with
+a long-enough timeout, then connection keep-alive could be enabled.
* *layout*: How to map key names to the path part of the URL. Available values:
+
--
m_http_client.set_default_headers({
{"User-Agent", FMT("{}/{}", CCACHE_NAME, CCACHE_VERSION)},
});
+ m_http_client.set_keep_alive(false);
auto connect_timeout = k_default_connect_timeout;
auto operation_timeout = k_default_operation_timeout;
for (const auto& attr : params.attributes) {
if (attr.key == "connect-timeout") {
connect_timeout = parse_timeout_attribute(attr.value);
+ } else if (attr.key == "keep-alive") {
+ m_http_client.set_keep_alive(attr.value == "true");
} else if (attr.key == "layout") {
if (attr.value == "bazel") {
m_layout = Layout::bazel;