mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 13:30:06 +00:00
Load archive warnings in a dedicated thread
This commit is contained in:
parent
8dde98d2a9
commit
ae24991432
1 changed files with 28 additions and 15 deletions
|
|
@ -239,24 +239,37 @@ void TextEventManager::SelectTime(
|
||||||
|
|
||||||
logger_->trace("Select Time: {}", util::TimeString(dateTime));
|
logger_->trace("Select Time: {}", util::TimeString(dateTime));
|
||||||
|
|
||||||
const auto today = std::chrono::floor<std::chrono::days>(dateTime);
|
boost::asio::post(
|
||||||
const auto yesterday = today - std::chrono::days {1};
|
p->threadPool_,
|
||||||
const auto tomorrow = today + std::chrono::days {1};
|
[=, this]()
|
||||||
const auto dateArray = std::array {today, yesterday, tomorrow};
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const auto today = std::chrono::floor<std::chrono::days>(dateTime);
|
||||||
|
const auto yesterday = today - std::chrono::days {1};
|
||||||
|
const auto tomorrow = today + std::chrono::days {1};
|
||||||
|
const auto dateArray = std::array {today, yesterday, tomorrow};
|
||||||
|
|
||||||
const auto dates =
|
const auto dates =
|
||||||
dateArray | ranges::views::filter(
|
dateArray |
|
||||||
[this](const auto& date)
|
ranges::views::filter(
|
||||||
{
|
[this](const auto& date)
|
||||||
return p->archiveLimit_ == std::chrono::sys_days {} ||
|
{
|
||||||
date < p->archiveLimit_;
|
return p->archiveLimit_ == std::chrono::sys_days {} ||
|
||||||
});
|
date < p->archiveLimit_;
|
||||||
|
});
|
||||||
|
|
||||||
std::unique_lock lock {p->archiveMutex_};
|
std::unique_lock lock {p->archiveMutex_};
|
||||||
|
|
||||||
p->UpdateArchiveDates(dates);
|
p->UpdateArchiveDates(dates);
|
||||||
p->ListArchives(dates);
|
p->ListArchives(dates);
|
||||||
p->LoadArchives(dateTime);
|
p->LoadArchives(dateTime);
|
||||||
|
}
|
||||||
|
catch (const std::exception& ex)
|
||||||
|
{
|
||||||
|
logger_->error(ex.what());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEventManager::Impl::HandleMessage(
|
void TextEventManager::Impl::HandleMessage(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue