fix(tvix/castore): Fix race when ingesting into castore
After finishing the ingestion, the directory putter was not being closed. This caused a race where the root directory node was accessed before the directory node had been flushed to the server. This patch makes it so we close the putter before returning the root node which should ensure that the root node exists on the directory service server before the `ingest_path` function returns. Fixes b/326 Change-Id: Id16cf46bc48962121dde76d3c9c23a845d87d0f1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9761 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
73a19c249e
commit
0325ae3ba3
1 changed files with 4 additions and 0 deletions
|
@ -189,6 +189,10 @@ pub async fn ingest_path<P: AsRef<Path> + Debug>(
|
|||
.await?;
|
||||
|
||||
if entry.depth() == 0 {
|
||||
// Make sure all the directories are flushed.
|
||||
if entry.file_type().is_dir() {
|
||||
directory_putter.close().await?;
|
||||
}
|
||||
return Ok(node);
|
||||
} else {
|
||||
// calculate the parent path, and make sure we register the node there.
|
||||
|
|
Loading…
Reference in a new issue