added medium frequency
This commit is contained in:
parent
7bd31b1c0a
commit
56350c8704
@ -32,7 +32,9 @@ public:
|
|||||||
enum struct frequency {
|
enum struct frequency {
|
||||||
high,
|
high,
|
||||||
low,
|
low,
|
||||||
|
medium,
|
||||||
second,
|
second,
|
||||||
|
size,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct polling_item final {
|
struct polling_item final {
|
||||||
@ -60,7 +62,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
app_config *config_{nullptr};
|
app_config *config_{nullptr};
|
||||||
std::array<std::unique_ptr<std::thread>, 3U> frequency_threads_;
|
std::array<std::unique_ptr<std::thread>,
|
||||||
|
static_cast<std::size_t>(frequency::size)>
|
||||||
|
frequency_threads_;
|
||||||
std::unordered_map<std::string, polling_item> items_;
|
std::unordered_map<std::string, polling_item> items_;
|
||||||
std::mutex mutex_;
|
std::mutex mutex_;
|
||||||
std::condition_variable notify_;
|
std::condition_variable notify_;
|
||||||
|
@ -34,7 +34,7 @@ constexpr const auto default_api_auth_size = 48U;
|
|||||||
constexpr const auto default_download_timeout_ces = 30U;
|
constexpr const auto default_download_timeout_ces = 30U;
|
||||||
constexpr const auto default_eviction_delay_mins = 10U;
|
constexpr const auto default_eviction_delay_mins = 10U;
|
||||||
constexpr const auto default_high_freq_interval_secs = 30U;
|
constexpr const auto default_high_freq_interval_secs = 30U;
|
||||||
constexpr const auto default_med_freq_interval_secs = 5U * 60U;
|
constexpr const auto default_med_freq_interval_secs = 2U * 60U;
|
||||||
constexpr const auto default_low_freq_interval_secs = 60U * 60U;
|
constexpr const auto default_low_freq_interval_secs = 60U * 60U;
|
||||||
constexpr const auto default_max_cache_size_bytes =
|
constexpr const auto default_max_cache_size_bytes =
|
||||||
20ULL * 1024ULL * 1024ULL * 1024ULL;
|
20ULL * 1024ULL * 1024ULL * 1024ULL;
|
||||||
|
@ -781,7 +781,7 @@ void file_manager::start() {
|
|||||||
|
|
||||||
polling::instance().set_callback({
|
polling::instance().set_callback({
|
||||||
"db_cleanup",
|
"db_cleanup",
|
||||||
polling::frequency::high,
|
polling::frequency::medium,
|
||||||
[this](auto && /* stop_requested */) {
|
[this](auto && /* stop_requested */) {
|
||||||
mutex_lock lock(upload_mtx_);
|
mutex_lock lock(upload_mtx_);
|
||||||
sqlite3_db_release_memory(db_.get());
|
sqlite3_db_release_memory(db_.get());
|
||||||
|
@ -111,6 +111,15 @@ void polling::start(app_config *config) {
|
|||||||
frequency::low);
|
frequency::low);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frequency_threads_.at(idx++) =
|
||||||
|
std::make_unique<std::thread>([this]() -> void {
|
||||||
|
this->frequency_thread(
|
||||||
|
[this]() -> std::uint32_t {
|
||||||
|
return config_->get_med_frequency_interval_secs();
|
||||||
|
},
|
||||||
|
frequency::medium);
|
||||||
|
});
|
||||||
|
|
||||||
frequency_threads_.at(idx++) =
|
frequency_threads_.at(idx++) =
|
||||||
std::make_unique<std::thread>([this]() -> void {
|
std::make_unique<std::thread>([this]() -> void {
|
||||||
this->frequency_thread([]() -> std::uint32_t { return 1U; },
|
this->frequency_thread([]() -> std::uint32_t { return 1U; },
|
||||||
|
@ -81,7 +81,7 @@ const auto DEFAULT_SIA_CONFIG = "{\n"
|
|||||||
" \"LowFreqIntervalSeconds\": 3600,\n"
|
" \"LowFreqIntervalSeconds\": 3600,\n"
|
||||||
" \"MaxCacheSizeBytes\": 21474836480,\n"
|
" \"MaxCacheSizeBytes\": 21474836480,\n"
|
||||||
" \"MaxUploadCount\": 5,\n"
|
" \"MaxUploadCount\": 5,\n"
|
||||||
" \"MedFreqIntervalSeconds\": 300,\n"
|
" \"MedFreqIntervalSeconds\": 120,\n"
|
||||||
" \"OnlineCheckRetrySeconds\": 60,\n"
|
" \"OnlineCheckRetrySeconds\": 60,\n"
|
||||||
" \"OrphanedFileRetentionDays\": 15,\n"
|
" \"OrphanedFileRetentionDays\": 15,\n"
|
||||||
" \"PreferredDownloadType\": \"fallback\",\n"
|
" \"PreferredDownloadType\": \"fallback\",\n"
|
||||||
@ -127,7 +127,7 @@ const auto DEFAULT_S3_CONFIG = "{\n"
|
|||||||
" \"LowFreqIntervalSeconds\": 3600,\n"
|
" \"LowFreqIntervalSeconds\": 3600,\n"
|
||||||
" \"MaxCacheSizeBytes\": 21474836480,\n"
|
" \"MaxCacheSizeBytes\": 21474836480,\n"
|
||||||
" \"MaxUploadCount\": 5,\n"
|
" \"MaxUploadCount\": 5,\n"
|
||||||
" \"MedFreqIntervalSeconds\": 300,\n"
|
" \"MedFreqIntervalSeconds\": 120,\n"
|
||||||
" \"OnlineCheckRetrySeconds\": 60,\n"
|
" \"OnlineCheckRetrySeconds\": 60,\n"
|
||||||
" \"OrphanedFileRetentionDays\": 15,\n"
|
" \"OrphanedFileRetentionDays\": 15,\n"
|
||||||
" \"PreferredDownloadType\": \"fallback\",\n"
|
" \"PreferredDownloadType\": \"fallback\",\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user