unit tests and fixes
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2024-12-20 18:39:10 -06:00
parent a9be30e6e7
commit df60ac8dfc
3 changed files with 18 additions and 11 deletions

View File

@ -115,16 +115,7 @@ private:
[[nodiscard]] auto load() -> bool; [[nodiscard]] auto load() -> bool;
template <typename dest, typename source> template <typename dest, typename source>
auto set_value(dest &dst, const source &src) -> bool { auto set_value(dest &dst, const source &src) -> bool;
if (dst.load() == src) {
return false;
}
dst = src;
config_changed_ = true;
save();
return true;
}
public: public:
[[nodiscard]] auto get_api_auth() const -> std::string; [[nodiscard]] auto get_api_auth() const -> std::string;

View File

@ -41,7 +41,8 @@ constexpr const auto default_task_wait_ms{100U};
constexpr const auto default_timeout_ms{60000U}; constexpr const auto default_timeout_ms{60000U};
constexpr const auto max_orphaned_file_retention_days{std::uint16_t(31U)}; constexpr const auto max_orphaned_file_retention_days{std::uint16_t(31U)};
constexpr const auto max_ring_buffer_file_size{std::uint16_t(1024U)}; constexpr const auto max_ring_buffer_file_size{std::uint16_t(1024U)};
constexpr const auto min_cache_size_bytes{100UL * 1024UL * 1024UL}; constexpr const auto min_cache_size_bytes{
std::uint64_t(100UL * 1024UL * 1024UL)};
constexpr const auto min_download_timeout_secs{std::uint8_t(5U)}; constexpr const auto min_download_timeout_secs{std::uint8_t(5U)};
constexpr const auto min_online_check_retry_secs{std::uint16_t(15U)}; constexpr const auto min_online_check_retry_secs{std::uint16_t(15U)};
constexpr const auto min_orphaned_file_retention_days{std::uint16_t(1U)}; constexpr const auto min_orphaned_file_retention_days{std::uint16_t(1U)};

View File

@ -1239,9 +1239,24 @@ void app_config::set_sia_config(sia_config value) {
} }
void app_config::set_task_wait_ms(std::uint16_t value) { void app_config::set_task_wait_ms(std::uint16_t value) {
std::cout << task_wait_ms_.load() << '|' << value << std::endl;
set_value(task_wait_ms_, value); set_value(task_wait_ms_, value);
} }
template <typename dest, typename source>
auto app_config::set_value(dest &dst, const source &src) -> bool {
if (dst.load() == src) {
return false;
}
std::cout << "changed" << std::endl;
dst = src;
config_changed_ = true;
save();
return true;
}
auto app_config::set_value_by_name(const std::string &name, auto app_config::set_value_by_name(const std::string &name,
const std::string &value) -> std::string { const std::string &value) -> std::string {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();