Skip to content

Commit

Permalink
Improve comments in garbage_collection task
Browse files Browse the repository at this point in the history
  • Loading branch information
sandreae committed Aug 22, 2023
1 parent fef61a6 commit 4a4bb40
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions aquadoggo/src/materializer/tasks/garbage_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ pub async fn garbage_collection_task(context: Context, input: TaskInput) -> Task
let mut all_effected_child_relations = vec![];
let mut deleted_views_count = 0;
for document_view_id in &all_document_view_ids {
// Check if this is the current view of it's document.
// Check if this is the current view of it's document. This will still return true
// if the document in question is deleted.
let is_current_view = context
.store
.is_current_view(document_view_id)
Expand Down Expand Up @@ -77,9 +78,9 @@ pub async fn garbage_collection_task(context: Context, input: TaskInput) -> Task
}
}

// If the number of deleted views equals the total existing views, then there is a
// chance this became completely detached. In this case we should check if this
// document is a blob document and then try to purge it.
// If the number of deleted views equals the total existing views (minus one for the
// current view), then there is a chance this became completely detached. In this case
// we should check if this document is a blob document and then try to purge it.
if all_document_view_ids.len() - 1 == deleted_views_count {
let operation = context
.store
Expand Down

0 comments on commit 4a4bb40

Please sign in to comment.