mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-11-01 09:30:06 +00:00
Use mutex to allow for concurrent update requests
This commit is contained in:
parent
08654bb7b0
commit
26ea4f4771
1 changed files with 8 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ static const std::string kScwxReleaseEndpoint {
|
||||||
class UpdateManager::Impl
|
class UpdateManager::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(UpdateManager* self) : self_ {self}, releases_ {} {}
|
explicit Impl(UpdateManager* self) : self_ {self} {}
|
||||||
|
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
|
|
@ -38,9 +38,11 @@ public:
|
||||||
|
|
||||||
UpdateManager* self_;
|
UpdateManager* self_;
|
||||||
|
|
||||||
std::vector<types::gh::Release> releases_;
|
std::mutex updateMutex_ {};
|
||||||
types::gh::Release latestRelease_;
|
|
||||||
std::string latestVersion_;
|
std::vector<types::gh::Release> releases_ {};
|
||||||
|
types::gh::Release latestRelease_ {};
|
||||||
|
std::string latestVersion_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
UpdateManager::UpdateManager() : p(std::make_unique<Impl>(this)) {}
|
UpdateManager::UpdateManager() : p(std::make_unique<Impl>(this)) {}
|
||||||
|
|
@ -97,6 +99,8 @@ boost::json::value UpdateManager::Impl::ParseResponseText(const std::string& s)
|
||||||
|
|
||||||
bool UpdateManager::CheckForUpdates(const std::string& currentVersion)
|
bool UpdateManager::CheckForUpdates(const std::string& currentVersion)
|
||||||
{
|
{
|
||||||
|
std::unique_lock lock(p->updateMutex_);
|
||||||
|
|
||||||
logger_->info("Checking for updates");
|
logger_->info("Checking for updates");
|
||||||
|
|
||||||
// Query GitHub for releases
|
// Query GitHub for releases
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue