mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 09:50: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)); | ||||
| 
 | ||||
|    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}; | ||||
|    boost::asio::post( | ||||
|       p->threadPool_, | ||||
|       [=, this]() | ||||
|       { | ||||
|          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 = | ||||
|       dateArray | ranges::views::filter( | ||||
|                      [this](const auto& date) | ||||
|                      { | ||||
|                         return p->archiveLimit_ == std::chrono::sys_days {} || | ||||
|                                date < p->archiveLimit_; | ||||
|                      }); | ||||
|             const auto dates = | ||||
|                dateArray | | ||||
|                ranges::views::filter( | ||||
|                   [this](const auto& date) | ||||
|                   { | ||||
|                      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->ListArchives(dates); | ||||
|    p->LoadArchives(dateTime); | ||||
|             p->UpdateArchiveDates(dates); | ||||
|             p->ListArchives(dates); | ||||
|             p->LoadArchives(dateTime); | ||||
|          } | ||||
|          catch (const std::exception& ex) | ||||
|          { | ||||
|             logger_->error(ex.what()); | ||||
|          } | ||||
|       }); | ||||
| } | ||||
| 
 | ||||
| void TextEventManager::Impl::HandleMessage( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat