allow limiting concurrent http requests

add Semaphore
update SettingsManager a little
This commit is contained in:
ouwou
2020-10-04 02:28:48 -04:00
parent bbe36a8246
commit 43f87b4bca
7 changed files with 67 additions and 9 deletions

View File

@@ -5,6 +5,7 @@
#include <filesystem>
#include <vector>
#include <unordered_map>
#include "util.hpp"
// todo throttle requests and keep track of active requests to stop redundant requests
@@ -23,6 +24,8 @@ private:
void RespondFromPath(std::filesystem::path path, callback_type cb);
void OnResponse(const cpr::Response &r);
std::unique_ptr<Semaphore> m_semaphore;
std::unordered_map<std::string, std::vector<callback_type>> m_callbacks;
std::vector<std::future<void>> m_futures;
std::filesystem::path m_tmp_path;