Permit proven closed-control fresh sync and retry only precommit clock reads
Rust development slice / linux (push) Failing after 6s
Rust development slice / linux (push) Failing after 6s
This commit is contained in:
@@ -922,8 +922,54 @@ impl SystemHelper {
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
fn wait_apply_clock(&self,issued:chrono::DateTime<chrono::Utc>,until:chrono::DateTime<chrono::Utc>)->Result<()> {
|
||||
crate::job_readiness::wait_for_helper_apply_clock(&self.clock,issued,until)
|
||||
// One authenticated control call, same original bytes/capture/deadline.
|
||||
// Only a typed clock failure proven before BEGIN can be retried.
|
||||
fn apply_control_with_clock(
|
||||
&mut self,
|
||||
response: &rmm_agent_core::helper_reconcile::SignedResponse,
|
||||
request: &[u8],
|
||||
issued: chrono::DateTime<chrono::Utc>,
|
||||
until: chrono::DateTime<chrono::Utc>,
|
||||
) -> Result<rmm_agent_core::helper_reconcile::Applied> {
|
||||
let began = Instant::now();
|
||||
loop {
|
||||
ensure!(
|
||||
began.elapsed() < Duration::from_secs(3),
|
||||
"SYSTEM_APPLY_CLOCK_WAIT_EXPIRED"
|
||||
);
|
||||
match crate::job_readiness::response_window(
|
||||
issued,
|
||||
until,
|
||||
began.elapsed(),
|
||||
self.clock.reading().ok().map(|r| (r.own_wall, r.upper)),
|
||||
) {
|
||||
crate::job_readiness::ResponseWindow::WaitForClock => {
|
||||
std::thread::sleep(Duration::from_millis(20));
|
||||
continue;
|
||||
}
|
||||
crate::job_readiness::ResponseWindow::Expired => {
|
||||
anyhow::bail!("SYSTEM_APPLY_ORIGINAL_DEADLINE_EXPIRED")
|
||||
}
|
||||
crate::job_readiness::ResponseWindow::WithinWindow => {}
|
||||
}
|
||||
self.sync()?;
|
||||
match self.sync.as_mut().unwrap().apply(
|
||||
&mut self.db,
|
||||
&self.guard,
|
||||
response,
|
||||
request,
|
||||
&self.clock,
|
||||
&self.boot,
|
||||
) {
|
||||
Ok(value) => return Ok(value),
|
||||
Err(error)
|
||||
if rmm_agent_core::helper_reconcile::retryable_precommit_clock(&error) =>
|
||||
{
|
||||
std::thread::sleep(Duration::from_millis(20))
|
||||
}
|
||||
Err(error) => return Err(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Passive, bounded static denial metadata only. Never feeds a gate.
|
||||
fn record_apply_error(&mut self,error:&anyhow::Error)->Result<()> {
|
||||
@@ -1025,15 +1071,11 @@ impl SystemHelper {
|
||||
// Same authenticated original call, BEFORE any application.
|
||||
// The independent time pipe continues on its own thread.
|
||||
// No signature/deadline/lease is relaxed and no Execute retry.
|
||||
self.wait_apply_clock(decision.issued_at,decision.valid_until)?;
|
||||
self.sync()?;
|
||||
let value = self.sync.as_mut().unwrap().apply(
|
||||
&mut self.db,
|
||||
&self.guard,
|
||||
let value = self.apply_control_with_clock(
|
||||
response,
|
||||
request_bytes,
|
||||
&self.clock,
|
||||
&self.boot,
|
||||
decision.issued_at,
|
||||
decision.valid_until,
|
||||
)?;
|
||||
let no_start_anchor = if value.ready && self.settings.enable_effects {
|
||||
let guard = DenialGuard {
|
||||
|
||||
Reference in New Issue
Block a user