From b9fdd9da4f20a3e1a920118f9c45704c45c46dcb Mon Sep 17 00:00:00 2001 From: Pavel Isaev Date: Wed, 11 Nov 2026 01:49:46 +0300 Subject: [PATCH] Retry a Busy extension Stage so update checks do not strand plans (D-105) --- src/service/client.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/service/client.rs b/src/service/client.rs index b39e3fd..061d9e0 100644 --- a/src/service/client.rs +++ b/src/service/client.rs @@ -116,7 +116,19 @@ impl Client { fn stage(&self, plan: Value) -> Result { let id = plan["plan_id"].as_str().ok_or("Missing prepared plan identity")?; self.output.borrow_mut().record("plan", &plan); - self.operation(false,"Stage",&(id,self.options())) + // A periodic update check (or another client) may hold a read-only + // operation, which the daemon reports as Busy. Wait for it to finish + // instead of leaving the freshly prepared extension plan unapplied. + let deadline = Instant::now() + Duration::from_secs(180); + loop { + match self.operation(false,"Stage",&(id,self.options())) { + Err(e) if e.contains("Error.Busy") && Instant::now() < deadline => { + self.output.borrow_mut().progress("waiting-active-operation"); + std::thread::sleep(Duration::from_secs(5)); + } + result => return result, + } + } } fn dispatch(&self, args: &[&str]) -> Result { match args {