additional error handling
This commit is contained in:
@@ -239,7 +239,7 @@ public:
|
|||||||
for (std::uint8_t retry = 0U; !ret && retry < 5U; ++retry) {
|
for (std::uint8_t retry = 0U; !ret && retry < 5U; ++retry) {
|
||||||
ret = do_request();
|
ret = do_request();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curl_code == CURLE_COULDNT_RESOLVE_HOST) {
|
if (curl_code == CURLE_COULDNT_RESOLVE_HOST) {
|
||||||
@@ -247,7 +247,7 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -70,8 +70,9 @@ private:
|
|||||||
-> api_error;
|
-> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto get_last_modified(bool directory,
|
[[nodiscard]] auto get_last_modified(bool directory,
|
||||||
const std::string &api_path) const
|
const std::string &api_path,
|
||||||
-> std::uint64_t;
|
std::uint64_t &last_modified) const
|
||||||
|
-> api_error;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
get_object_info(bool directory, const std::string &api_path,
|
get_object_info(bool directory, const std::string &api_path,
|
||||||
|
@@ -209,10 +209,18 @@ auto s3_provider::create_directory_paths(const std::string &api_path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::uint64_t last_modified{};
|
||||||
|
if (exists) {
|
||||||
|
res = get_last_modified(true, cur_path, last_modified);
|
||||||
|
if (res != api_error::success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
last_modified = utils::time::get_time_now();
|
||||||
|
}
|
||||||
|
|
||||||
auto dir{
|
auto dir{
|
||||||
create_api_file(cur_path, cur_key, 0U,
|
create_api_file(cur_path, cur_key, 0U, last_modified),
|
||||||
exists ? get_last_modified(true, cur_path)
|
|
||||||
: utils::time::get_time_now()),
|
|
||||||
};
|
};
|
||||||
get_api_item_added()(true, dir);
|
get_api_item_added()(true, dir);
|
||||||
}
|
}
|
||||||
@@ -624,16 +632,19 @@ auto s3_provider::get_file_list(api_file_list &list, std::string &marker) const
|
|||||||
return api_error::error;
|
return api_error::error;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto s3_provider::get_last_modified(bool directory,
|
auto s3_provider::get_last_modified(bool directory, const std::string &api_path,
|
||||||
const std::string &api_path) const
|
std::uint64_t &last_modified) const
|
||||||
-> std::uint64_t {
|
-> api_error {
|
||||||
bool is_encrypted{};
|
bool is_encrypted{};
|
||||||
std::string object_name;
|
std::string object_name;
|
||||||
head_object_result result{};
|
head_object_result result{};
|
||||||
return (get_object_info(directory, api_path, is_encrypted, object_name,
|
auto res =
|
||||||
result) == api_error::success)
|
get_object_info(directory, api_path, is_encrypted, object_name, result);
|
||||||
? result.last_modified
|
if (res == api_error::success) {
|
||||||
: utils::time::get_time_now();
|
last_modified = result.last_modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto s3_provider::get_object_info(bool directory, const std::string &api_path,
|
auto s3_provider::get_object_info(bool directory, const std::string &api_path,
|
||||||
|
Reference in New Issue
Block a user