Skip to content

Commit

Permalink
Move NFS-cache busting to where it's really needed
Browse files Browse the repository at this point in the history
The NFS directory cache is stored on a per-client basis, so the lexbox
backend pod isn't the place we need to run `ls` to invalidate the NFS
cache. The hgweb pod is where the `ls` needs to happen.
  • Loading branch information
rmunn committed May 8, 2024
1 parent d3e550d commit c87ec67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions backend/LexBoxApi/Services/HgService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ 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));
// Force NFS to refresh its directory cache.
Process.Start("ls", [PrefixRepoFilePath(code)]);
}

public async Task FinishReset(string code, Stream zipFile)
Expand Down Expand Up @@ -139,8 +137,6 @@ await Task.Run(() =>
// Now we're ready to move the new repo into place, replacing the old one
await DeleteRepo(code);
tempRepo.MoveTo(PrefixRepoFilePath(code));
// Force NFS to refresh its directory cache.
Process.Start("ls", [PrefixRepoFilePath(code)]);
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions hgweb/command-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ echo ""

# Run the hg command, simply output to stdout
first_char=$(echo $project_code | cut -c1)
# Ensure NFS cache is refreshed in case project repo changed in another pod (e.g., project reset)
ls /var/hg/repos/$first_char/$project_code > /dev/null # Don't need output; this is enough to refresh NFS dir cache
cd /var/hg/repos/$first_char/$project_code
case $command_name in

Expand Down

0 comments on commit c87ec67

Please sign in to comment.