refactor
This commit is contained in:
@ -28,6 +28,11 @@ namespace repertory {
|
|||||||
class app_config;
|
class app_config;
|
||||||
|
|
||||||
class cache_size_mgr final {
|
class cache_size_mgr final {
|
||||||
|
private:
|
||||||
|
static constexpr const std::chrono::seconds cache_wait_secs{
|
||||||
|
5s,
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cache_size_mgr(const cache_size_mgr &) = delete;
|
cache_size_mgr(const cache_size_mgr &) = delete;
|
||||||
cache_size_mgr(cache_size_mgr &&) = delete;
|
cache_size_mgr(cache_size_mgr &&) = delete;
|
||||||
|
@ -39,6 +39,11 @@ class i_provider;
|
|||||||
class file_manager final : public i_file_manager, public i_upload_manager {
|
class file_manager final : public i_file_manager, public i_upload_manager {
|
||||||
E_CONSUMER();
|
E_CONSUMER();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static constexpr const std::chrono::seconds queue_wait_secs{
|
||||||
|
5s,
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
file_manager(app_config &config, i_provider &provider);
|
file_manager(app_config &config, i_provider &provider);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
|
|||||||
max_cache_size);
|
max_cache_size);
|
||||||
last_cache_size = cache_size_;
|
last_cache_size = cache_size_;
|
||||||
}
|
}
|
||||||
notify_.wait_for(lock, 5s);
|
notify_.wait_for(lock, cache_wait_secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_.notify_all();
|
notify_.notify_all();
|
||||||
|
@ -1027,7 +1027,7 @@ void file_manager::upload_completed(const file_upload_completed &evt) {
|
|||||||
evt.get_api_path(), evt.get_source(), err);
|
evt.get_api_path(), evt.get_source(), err);
|
||||||
|
|
||||||
queue_upload(evt.get_api_path(), evt.get_source(), true);
|
queue_upload(evt.get_api_path(), evt.get_source(), true);
|
||||||
upload_notify_.wait_for(upload_lock, 5s);
|
upload_notify_.wait_for(upload_lock, queue_wait_secs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1091,7 +1091,7 @@ void file_manager::upload_handler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (should_wait) {
|
if (should_wait) {
|
||||||
upload_notify_.wait_for(upload_lock, 5s);
|
upload_notify_.wait_for(upload_lock, queue_wait_secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
upload_notify_.notify_all();
|
upload_notify_.notify_all();
|
||||||
|
Reference in New Issue
Block a user