fix: repair proven unsent sync chain with signed archived receipt
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -5,6 +5,7 @@ mod api;
|
||||
mod artifact_store;
|
||||
mod auth;
|
||||
mod catalog;
|
||||
mod checkpoint_repair;
|
||||
mod controls;
|
||||
mod errors;
|
||||
mod gateway;
|
||||
@@ -68,6 +69,16 @@ async fn main() -> Result<()> {
|
||||
.await;
|
||||
}
|
||||
let profile = env::var("RMM_PROFILE").unwrap_or_default();
|
||||
gateway::dev_delivery_faults::validate_environment()?;
|
||||
let repair = env::args().nth(1).as_deref() == Some("repair-unsent-sync-request");
|
||||
if repair {
|
||||
ensure!(env::args().count() == 2, "REPAIR_NO_ARGUMENTS");
|
||||
checkpoint_repair::closed_policy()?;
|
||||
ensure!(
|
||||
std::path::Path::new(&env::var("RMM_JOB_KEY_FILE")?).is_file(),
|
||||
"REPAIR_EXISTING_KEY_REQUIRED"
|
||||
);
|
||||
}
|
||||
let dev = env::var("RMM_DEV_AUTH").as_deref() == Ok("true");
|
||||
ensure!(
|
||||
matches!(
|
||||
@@ -126,6 +137,19 @@ async fn main() -> Result<()> {
|
||||
.auth
|
||||
.validate_separation(&state.viewer_a, &state.viewer_b)?;
|
||||
}
|
||||
if repair {
|
||||
use std::io::{Read, Write};
|
||||
let mut raw = Vec::new();
|
||||
std::io::stdin()
|
||||
.take(32 * 1024 * 1024 + 1)
|
||||
.read_to_end(&mut raw)?;
|
||||
ensure!(raw.len() <= 32 * 1024 * 1024, "REPAIR_INPUT_SIZE");
|
||||
let evidence = serde_json::from_slice(&raw).context("REPAIR_EVIDENCE_JSON")?;
|
||||
let receipt = checkpoint_repair::issue(&state, evidence).await?;
|
||||
serde_json::to_writer(std::io::stdout().lock(), &receipt)?;
|
||||
std::io::stdout().write_all(b"\n")?;
|
||||
return Ok(());
|
||||
}
|
||||
if role.gateway() {
|
||||
scheduler::start(state.clone());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user