From 9f09751a8fb92e89209d6a3a568d17130d065e52 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 21 Sep 2023 22:09:54 -0400 Subject: [PATCH] Revert "overlays(zola): Potentially fix race condition" This didn't actually fix things. --- overlays/zola.nix | 5 +-- patches/zola-serve-race-condition-fix.patch | 40 --------------------- 2 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 patches/zola-serve-race-condition-fix.patch diff --git a/overlays/zola.nix b/overlays/zola.nix index ded6bdf1..28589a93 100644 --- a/overlays/zola.nix +++ b/overlays/zola.nix @@ -2,10 +2,7 @@ nixpkgs.overlays = [ (final: prev: { zola = prev.zola.overrideAttrs (oldAttrs: { - patches = (oldAttrs.patches or [ ]) ++ [ - ../patches/zola-serve-fix.patch - ../patches/zola-serve-race-condition-fix.patch - ]; + patches = (oldAttrs.patches or [ ]) ++ [ ../patches/zola-serve-fix.patch ]; }); }) ]; diff --git a/patches/zola-serve-race-condition-fix.patch b/patches/zola-serve-race-condition-fix.patch deleted file mode 100644 index 6b87e9ba..00000000 --- a/patches/zola-serve-race-condition-fix.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 25bf5d41182e7d15917ec2789dc08b74a7ed054c Mon Sep 17 00:00:00 2001 -From: Andrew Langmeier -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()))?;