diff options
| author | Dan Engelbrecht <[email protected]> | 2024-08-19 14:03:19 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-08-19 14:03:19 +0200 |
| commit | ee129c0a8c667b10b0a66759d87871bdcff514a0 (patch) | |
| tree | 84d8d8a9f2a4475f521dedd1c870d85b6f2ef42a /src | |
| parent | if disk space is low, set the last gc time to avoid spamming retries (#124) (diff) | |
| download | zen-ee129c0a8c667b10b0a66759d87871bdcff514a0.tar.xz zen-ee129c0a8c667b10b0a66759d87871bdcff514a0.zip | |
verify that project oplog dir exists before trying to iterate it (#123)
Diffstat (limited to 'src')
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp index 77a064618..1454eab01 100644 --- a/src/zenserver/projectstore/projectstore.cpp +++ b/src/zenserver/projectstore/projectstore.cpp @@ -2353,14 +2353,20 @@ ProjectStore::Project::DeleteOplog(std::string_view OplogId) std::vector<std::string> ProjectStore::Project::ScanForOplogs() const { - DirectoryContent DirContent; - GetDirectoryContent(m_OplogStoragePath, DirectoryContent::IncludeDirsFlag, DirContent); + RwLock::SharedLockScope _(m_ProjectLock); + std::vector<std::string> Oplogs; - Oplogs.reserve(DirContent.Directories.size()); - for (const std::filesystem::path& DirPath : DirContent.Directories) + if (Project::Exists(m_OplogStoragePath)) { - Oplogs.push_back(DirPath.filename().string()); + DirectoryContent DirContent; + GetDirectoryContent(m_OplogStoragePath, DirectoryContent::IncludeDirsFlag, DirContent); + Oplogs.reserve(DirContent.Directories.size()); + for (const std::filesystem::path& DirPath : DirContent.Directories) + { + Oplogs.push_back(DirPath.filename().string()); + } } + return Oplogs; } |