Skip to content

Commit

Permalink
fix: drop temp tag after doc insert (#1810)
Browse files Browse the repository at this point in the history
## Description

When importing files into docs, the temp tag should only be dropped
*after* the hash was inserted into the doc. Otherwise gc could
potentially delete the blob if hitting in between the tag drop and the
completion of the doc insert.
  • Loading branch information
Frando authored Nov 15, 2023
1 parent c1aeeb1 commit a608fe8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,6 @@ impl<D: BaoStore> RpcHandler<D> {

let hash_and_format = temp_tag.inner();
let HashAndFormat { hash, .. } = *hash_and_format;
drop(temp_tag);
self.inner
.sync
.doc_set_hash(DocSetHashRequest {
Expand All @@ -1049,6 +1048,7 @@ impl<D: BaoStore> RpcHandler<D> {
size,
})
.await?;
drop(temp_tag);
progress.send(DocImportProgress::AllDone { key }).await?;
Ok(())
}
Expand Down

0 comments on commit a608fe8

Please sign in to comment.