Fence Windows sync until the helper confirms the signed decision
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -498,6 +498,8 @@ struct Agent {
|
||||
#[cfg(feature = "system-helper")]
|
||||
prepared_request: Option<Vec<u8>>,
|
||||
#[cfg(feature = "system-helper")]
|
||||
helper_apply_unconfirmed: bool,
|
||||
#[cfg(feature = "system-helper")]
|
||||
helper_lane: Arc<tokio::sync::Semaphore>,
|
||||
#[cfg(feature = "system-helper")]
|
||||
helper: Option<rmm_agent_windows::helper_runtime::Client>,
|
||||
@@ -693,6 +695,7 @@ impl Agent {
|
||||
#[cfg(feature = "system-helper")]
|
||||
{
|
||||
self.helper_control.is_some()
|
||||
|| self.helper_apply_unconfirmed
|
||||
|| self.helper_probe.is_some()
|
||||
|| !self.helper_checked
|
||||
|| self.helper_refused
|
||||
@@ -789,6 +792,7 @@ impl Agent {
|
||||
} else {
|
||||
sync.confirm_helper(&mapped)?;
|
||||
}
|
||||
self.helper_apply_unconfirmed = false;
|
||||
self.open_fence(generation)?;
|
||||
}
|
||||
}
|
||||
@@ -825,6 +829,7 @@ impl Agent {
|
||||
}
|
||||
if self.helper_probe.is_none()
|
||||
&& self.helper_control.is_none()
|
||||
&& !self.helper_apply_unconfirmed
|
||||
&& !self.prepared
|
||||
&& self.running.is_none()
|
||||
&& !self.journal.connection().query_row("SELECT EXISTS(SELECT 1 FROM job_attempts WHERE state IN ('requesting','running','verifying'))",[],|r|r.get::<_,bool>(0))?
|
||||
@@ -1124,6 +1129,10 @@ impl Agent {
|
||||
self.prepared = false;
|
||||
let sync = self.sync.as_mut().context("SYNC_NOT_CONFIGURED")?;
|
||||
let applied = sync.apply(self.journal.connection_mut(), &response, &self.clock)?;
|
||||
#[cfg(feature = "system-helper")]
|
||||
if applied.helper_instruction.is_some() {
|
||||
self.helper_apply_unconfirmed = true;
|
||||
}
|
||||
sync.apply_consumption(
|
||||
self.ledger.as_mut().context("LEDGER_REQUIRED")?,
|
||||
&self.clock,
|
||||
@@ -1140,11 +1149,15 @@ impl Agent {
|
||||
.prepared_request
|
||||
.take()
|
||||
.context("ORIGINAL_SYNC_REQUEST_REQUIRED")?;
|
||||
let until = sync.validity_deadline().context("SIGNED_LEASE_REQUIRED")?;
|
||||
let clock = self.clock.clone();
|
||||
let boot = self.channel(generation)?.boot_id;
|
||||
self.helper_control = Some(HelperControl::Apply(
|
||||
generation,
|
||||
tokio::spawn(async move {
|
||||
helper.apply(&instruction.response, request, boot).await
|
||||
helper
|
||||
.apply(&instruction.response, request, boot, until, &clock)
|
||||
.await
|
||||
}),
|
||||
));
|
||||
return Ok(());
|
||||
@@ -1594,6 +1607,12 @@ impl Agent {
|
||||
}
|
||||
async fn session(&mut self, stop: &AtomicBool) -> Result<()> {
|
||||
self.close_gate();
|
||||
#[cfg(feature = "system-helper")]
|
||||
{
|
||||
// Reconnect discards the old channel. ClientSync::prepare checks
|
||||
// the authenticated helper head against the durable agent journal.
|
||||
self.helper_apply_unconfirmed = false;
|
||||
}
|
||||
let result = self.session_inner(stop).await;
|
||||
self.close_gate();
|
||||
#[cfg(feature = "system-helper")]
|
||||
@@ -1922,6 +1941,8 @@ fn service_run(stop: &'static AtomicBool) -> Result<()> {
|
||||
#[cfg(feature="system-helper")]
|
||||
prepared_request:None,
|
||||
#[cfg(feature="system-helper")]
|
||||
helper_apply_unconfirmed:false,
|
||||
#[cfg(feature="system-helper")]
|
||||
helper_lane:Arc::new(tokio::sync::Semaphore::new(1)),
|
||||
#[cfg(feature="system-helper")]
|
||||
helper:None,
|
||||
|
||||
Reference in New Issue
Block a user