Skip to content

Commit

Permalink
Merge branch 'main' into fix-document-check
Browse files Browse the repository at this point in the history
  • Loading branch information
adzialocha authored Jun 26, 2024
2 parents 3ddb9d4 + 1adec6d commit 1a5201d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Handle connection ids greater than 9 in `Peer` impl of `Human` trait [#634](https://github.com/p2panda/aquadoggo/pull/634)
- Safely handle missing document when retrieving document view from store [#637](https://github.com/p2panda/aquadoggo/pull/637)
- Check if blob file exists before deleting it from fs [#636](https://github.com/p2panda/aquadoggo/pull/636)

## [0.7.4]

Expand Down
14 changes: 8 additions & 6 deletions aquadoggo/src/materializer/tasks/garbage_collection.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

use tokio::fs::remove_file;
use tokio::fs::{remove_file, try_exists};

use log::debug;
use p2panda_rs::document::DocumentViewId;
Expand Down Expand Up @@ -138,12 +138,14 @@ pub async fn garbage_collection_task(context: Context, input: TaskInput) -> Task
// We now remove all deleted blob views from the filesystem.
if is_blob {
for view_id in deleted_views {
// Delete this blob view from the filesystem also.
// Delete this blob view from the filesystem also
let blob_view_path = context.config.blobs_base_path.join(view_id.to_string());
remove_file(blob_view_path.clone())
.await
.map_err(|err| TaskError::Critical(err.to_string()))?;
debug!("Deleted blob view from filesystem: {}", view_id);
if let Ok(true) = try_exists(&blob_view_path).await {
remove_file(blob_view_path)
.await
.map_err(|err| TaskError::Critical(err.to_string()))?;
debug!("Deleted blob view from filesystem: {}", view_id);
}
}
}

Expand Down

0 comments on commit 1a5201d

Please sign in to comment.