1
0
mirror of synced 2025-02-26 06:18:05 +01:00

feat: Add more details to startup tasks (#1301)

This commit is contained in:
iTrooz 2023-09-09 12:49:15 +02:00 committed by GitHub
parent 83e26522b6
commit e65021c85e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,11 +75,12 @@ namespace hex::init {
}; };
auto startTime = std::chrono::high_resolution_clock::now(); auto startTime = std::chrono::high_resolution_clock::now();
if (!task()) bool taskStatus = task();
status = false;
auto endTime = std::chrono::high_resolution_clock::now(); auto endTime = std::chrono::high_resolution_clock::now();
log::info("Task '{}' finished in {} ms", name, std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count()); log::info("Task '{}' finished in {} ms (success={})", name, std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count(), taskStatus);
status = status && taskStatus;
{ {
std::lock_guard guard(this->m_progressMutex); std::lock_guard guard(this->m_progressMutex);
@ -215,7 +216,13 @@ namespace hex::init {
// Check if all background tasks have finished so the splash screen can be closed // Check if all background tasks have finished so the splash screen can be closed
if (this->tasksSucceeded.wait_for(0s) == std::future_status::ready) { if (this->tasksSucceeded.wait_for(0s) == std::future_status::ready) {
return this->tasksSucceeded.get() ? FrameResult::success : FrameResult::failure; if (this->tasksSucceeded.get()) {
log::debug("All tasks finished with success !");
return FrameResult::success;
} else {
log::warn("All tasks finished, but some failed");
return FrameResult::failure;
}
} }
return FrameResult::wait; return FrameResult::wait;