1
0
forked from extern/nix-config

Revert "overlays(zola): Potentially fix race condition"

This didn't actually fix things.
This commit is contained in:
Donovan Glover 2023-09-21 22:09:54 -04:00
parent a6ff3122b9
commit 9f09751a8f
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 1 additions and 44 deletions

View File

@ -2,10 +2,7 @@
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
zola = prev.zola.overrideAttrs (oldAttrs: { zola = prev.zola.overrideAttrs (oldAttrs: {
patches = (oldAttrs.patches or [ ]) ++ [ patches = (oldAttrs.patches or [ ]) ++ [ ../patches/zola-serve-fix.patch ];
../patches/zola-serve-fix.patch
../patches/zola-serve-race-condition-fix.patch
];
}); });
}) })
]; ];

View File

@ -1,40 +0,0 @@
From 25bf5d41182e7d15917ec2789dc08b74a7ed054c Mon Sep 17 00:00:00 2001
From: Andrew Langmeier <raymi306@gmail.com>
Date: Sun, 17 Sep 2023 14:46:59 -0400
Subject: [PATCH] Attempt to prevent possible race condition
If the site rebuilds and the config.toml file hasn't been moved over on top of the removed version, the site cannot rebuild correctly
---
src/cmd/serve.rs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs
index 35fd85f1f..2f7d48fba 100644
--- a/src/cmd/serve.rs
+++ b/src/cmd/serve.rs
@@ -669,6 +669,25 @@ pub fn serve(
site = s;
}
let entry = config_path_rel.to_str().unwrap_or("config.toml");
+ let mut path_exists = false;
+ let mut tries = 0;
+ let max_attempts = 3;
+ while tries < max_attempts {
+ if config_path.exists() {
+ path_exists = true;
+ break;
+ }
+ tries += 1;
+ thread::sleep(Duration::from_millis(100));
+ }
+ if !path_exists {
+ return Err(
+ std::io::Error::new(
+ std::io::ErrorKind::NotFound,
+ "Received NotifyRemove on a required file, and file did not reappear in time",
+ ).into()
+ );
+ }
watcher
.watch(root_dir.join(entry), RecursiveMode::Recursive)
.with_context(|| format!("Can't watch `{}` for changes in folder `{}`. Does it exist, and do you have correct permissions?", entry, root_dir.display()))?;