mirror of https://github.com/mamba-org/mamba.git
fix: Parse `remote_connect_timeout_secs` as a double (#2949)
* fix: Parse `remote_connect_timeout_secs` as a double Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * test: Test parsing of `.condarc` Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> * fixup! test: Test parsing of `.condarc` * lint: Format .condarc Signed-off-by: Julien Jerphanion <git@jjerphan.xyz> --------- Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
This commit is contained in:
parent
c33df03cba
commit
cab1bbfdbb
|
@ -74,7 +74,7 @@ namespace mamba
|
|||
|
||||
std::string user_agent{ "mamba/" LIBMAMBA_VERSION_STRING };
|
||||
|
||||
int connect_timeout_secs{ 10 };
|
||||
double connect_timeout_secs{ 10. };
|
||||
// int read_timeout_secs { 60 };
|
||||
int retry_timeout{ 2 }; // seconds
|
||||
int retry_backoff{ 3 }; // retry_timeout * retry_backoff
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace mamba
|
|||
CURL* handle,
|
||||
const std::string& url,
|
||||
const bool set_low_speed_opt,
|
||||
const long connect_timeout_secs,
|
||||
const double connect_timeout_secs,
|
||||
const bool set_ssl_no_revoke,
|
||||
const std::optional<std::string>& proxy,
|
||||
const std::string& ssl_verify
|
||||
|
@ -123,7 +123,7 @@ namespace mamba
|
|||
bool check_resource_exists(
|
||||
const std::string& url,
|
||||
const bool set_low_speed_opt,
|
||||
const long connect_timeout_secs,
|
||||
const double connect_timeout_secs,
|
||||
const bool set_ssl_no_revoke,
|
||||
const std::optional<std::string>& proxy,
|
||||
const std::string& ssl_verify
|
||||
|
@ -392,7 +392,7 @@ namespace mamba
|
|||
void CURLHandle::configure_handle(
|
||||
const std::string& url,
|
||||
const bool set_low_speed_opt,
|
||||
const long connect_timeout_secs,
|
||||
const double connect_timeout_secs,
|
||||
const bool set_ssl_no_revoke,
|
||||
const std::optional<std::string>& proxy,
|
||||
const std::string& ssl_verify
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace mamba
|
|||
CURL* handle,
|
||||
const std::string& url,
|
||||
const bool set_low_speed_opt,
|
||||
const long connect_timeout_secs,
|
||||
const double connect_timeout_secs,
|
||||
const bool set_ssl_no_revoke,
|
||||
const std::optional<std::string>& proxy,
|
||||
const std::string& ssl_verify
|
||||
|
@ -38,7 +38,7 @@ namespace mamba
|
|||
bool check_resource_exists(
|
||||
const std::string& url,
|
||||
const bool set_low_speed_opt,
|
||||
const long connect_timeout_secs,
|
||||
const double connect_timeout_secs,
|
||||
const bool set_ssl_no_revoke,
|
||||
const std::optional<std::string>& proxy,
|
||||
const std::string& ssl_verify
|
||||
|
@ -120,7 +120,7 @@ namespace mamba
|
|||
void configure_handle(
|
||||
const std::string& url,
|
||||
const bool set_low_speed_opt,
|
||||
const long connect_timeout_secs,
|
||||
const double connect_timeout_secs,
|
||||
const bool set_ssl_no_revoke,
|
||||
const std::optional<std::string>& proxy,
|
||||
const std::string& ssl_verify
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
channels:
|
||||
- https://repo.mamba.pm/conda-forge
|
||||
|
||||
|
||||
# See: https://github.com/mamba-org/mamba/issues/2934
|
||||
remote_connect_timeout_secs: 9.15
|
||||
|
|
|
@ -158,6 +158,17 @@ namespace mamba
|
|||
CHECK_EQ(config.dump(MAMBA_SHOW_CONFIG_VALUES | MAMBA_SHOW_CONFIG_SRCS), "");
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/mamba-org/mamba/issues/2934
|
||||
TEST_CASE_FIXTURE(Configuration, "parse_condarc")
|
||||
{
|
||||
std::vector<fs::u8path> possible_rc_paths = {
|
||||
test_data_dir / "config/.condarc",
|
||||
};
|
||||
|
||||
config.set_rc_values(possible_rc_paths, RCConfigLevel::kTargetPrefix);
|
||||
};
|
||||
|
||||
|
||||
TEST_CASE_FIXTURE(Configuration, "load_rc_files")
|
||||
{
|
||||
std::string rc1 = unindent(R"(
|
||||
|
|
|
@ -421,12 +421,12 @@ class Context:
|
|||
class RemoteFetchParams:
|
||||
def __init__(self) -> None: ...
|
||||
@property
|
||||
def connect_timeout_secs(self) -> int:
|
||||
def connect_timeout_secs(self) -> float:
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
@connect_timeout_secs.setter
|
||||
def connect_timeout_secs(self, arg0: int) -> None:
|
||||
def connect_timeout_secs(self, arg0: float) -> None:
|
||||
pass
|
||||
@property
|
||||
def max_retries(self) -> int:
|
||||
|
@ -549,12 +549,12 @@ class Context:
|
|||
def conda_prefix(self, arg1: Path) -> None:
|
||||
pass
|
||||
@property
|
||||
def connect_timeout_secs(self) -> int:
|
||||
def connect_timeout_secs(self) -> float:
|
||||
"""
|
||||
:type: int
|
||||
"""
|
||||
@connect_timeout_secs.setter
|
||||
def connect_timeout_secs(self, arg1: int) -> None:
|
||||
def connect_timeout_secs(self, arg1: float) -> None:
|
||||
pass
|
||||
@property
|
||||
def custom_channels(self) -> typing.Dict[str, str]:
|
||||
|
|
|
@ -841,7 +841,7 @@ PYBIND11_MODULE(bindings, m)
|
|||
deprecated("Use `remote_fetch_params.connect_timeout_secs` instead.");
|
||||
return self.remote_fetch_params.connect_timeout_secs;
|
||||
},
|
||||
[](Context& self, int cts)
|
||||
[](Context& self, double cts)
|
||||
{
|
||||
deprecated("Use `remote_fetch_params.connect_timeout_secs` instead.");
|
||||
self.remote_fetch_params.connect_timeout_secs = cts;
|
||||
|
|
Loading…
Reference in New Issue