Skip to content

Commit

Permalink
Try calling sync before WaitForRepoEmptyState
Browse files Browse the repository at this point in the history
Hopefully this will make the NFS client flush its buffers.
  • Loading branch information
rmunn committed May 10, 2024
1 parent 8c020b1 commit a620a93
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backend/LexBoxApi/Services/HgService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ await Task.Run(() =>
{
InitRepoAt(new DirectoryInfo(PrefixRepoFilePath(code)));
});
await Process.Start("sync").WaitForExitAsync(); // TODO: Put behind an OS check so we don't break Windows
await WaitForRepoEmptyState(code, RepoEmptyState.Empty);
}

Expand Down Expand Up @@ -107,6 +108,7 @@ public async Task ResetRepo(string code)
await SoftDeleteRepo(code, $"{FileUtils.ToTimestamp(DateTimeOffset.UtcNow)}__reset");
//we must init the repo as uploading a zip is optional
tmpRepo.MoveTo(PrefixRepoFilePath(code));
await Process.Start("sync").WaitForExitAsync(); // TODO: Put behind an OS check so we don't break Windows
// await InvalidateDirCache(code); // TODO 789: Sometimes NFS hasn't finished the MoveTo above! So we need to find a way to wait until InvalidateDirCache sees an *empty* repo...
await WaitForRepoEmptyState(code, RepoEmptyState.Empty);
}
Expand Down Expand Up @@ -143,6 +145,7 @@ await Task.Run(() =>
await DeleteRepo(code);
tempRepo.MoveTo(PrefixRepoFilePath(code));
// await InvalidateDirCache(code);
await Process.Start("sync").WaitForExitAsync(); // TODO: Put behind an OS check so we don't break Windows
await WaitForRepoEmptyState(code, RepoEmptyState.NonEmpty); // TODO: Either catch the case where someone uploaded a .zip of an empty .hg repo, or set a timeout in WaitForRepoEmptyState
}

Expand Down

0 comments on commit a620a93

Please sign in to comment.