diff options
| author | Dan Engelbrecht <[email protected]> | 2024-09-04 10:03:38 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-09-04 10:03:38 +0200 |
| commit | c028afcc305457fc24ffc62b9b7197f44ba45689 (patch) | |
| tree | ba7e1929196e67d208745f8d7f065424677408b8 /src/zenutil/basicfile.cpp | |
| parent | move gc logs to gc logger (#142) (diff) | |
| download | zen-c028afcc305457fc24ffc62b9b7197f44ba45689.tar.xz zen-c028afcc305457fc24ffc62b9b7197f44ba45689.zip | |
clean cache slog files on startup (#143)
- Bugfix: If we fail to move a temporary file into place, try to re-open the file so we clean it up
- Improvement: Clean up cache bucket log files at startup as we store the matching information in the index snapshot for the bucket
Diffstat (limited to 'src/zenutil/basicfile.cpp')
| -rw-r--r-- | src/zenutil/basicfile.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/zenutil/basicfile.cpp b/src/zenutil/basicfile.cpp index 174125069..575d153b2 100644 --- a/src/zenutil/basicfile.cpp +++ b/src/zenutil/basicfile.cpp @@ -560,6 +560,13 @@ TemporaryFile::MoveTemporaryIntoPlace(std::filesystem::path FinalFileName, std:: BasicFile::Close(); std::filesystem::rename(m_TempPath, FinalFileName, Ec); + + if (Ec) + { + // Try to re-open the temp file so we clean up after us when TemporaryFile is destructed + std::error_code DummyEc; + Open(m_TempPath, BasicFile::Mode::kWrite, DummyEc); + } } ////////////////////////////////////////////////////////////////////////// |