aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/projectstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-11-28 23:34:00 +0100
committerGitHub Enterprise <[email protected]>2024-11-28 23:34:00 +0100
commitb960d42525ed1239dc32175204171880dc9a5403 (patch)
tree39536dca7f15f943ab4d451946874739f38fe940 /src/zenserver/projectstore/projectstore.cpp
parentfix oplog index path reading error (#246) (diff)
downloadzen-b960d42525ed1239dc32175204171880dc9a5403.tar.xz
zen-b960d42525ed1239dc32175204171880dc9a5403.zip
make sure we don't throw exception from worker thread (#247)
* Make sure we don't throw exception from worker thread * secure async project flush * secure workspaces * spelling
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 89fbff06c..1296f1269 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -3643,9 +3643,16 @@ ProjectStore::Flush()
for (const Ref<Project>& Project : Projects)
{
WorkLatch.AddCount(1);
- WorkerPool.ScheduleWork([&WorkLatch, Project]() {
+ WorkerPool.ScheduleWork([this, &WorkLatch, Project]() {
auto _ = MakeGuard([&WorkLatch]() { WorkLatch.CountDown(); });
- Project->Flush();
+ try
+ {
+ Project->Flush();
+ }
+ catch (const std::exception& Ex)
+ {
+ ZEN_WARN("Exception while flushing project {}: {}", Project->Identifier, Ex.what());
+ }
});
}