v0.3.15-pre.008-fix.001

This commit is contained in:
2026-09-13 22:34:26 +02:00
parent c71fb2d8fe
commit fe512637d4
4 changed files with 77 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-raw-transaction-ingest-desk/src/app_state.rs
// version: 4
// version: 5
//! Shared backend state owned by the Raw Transaction Ingest Desk Tauri application.
@@ -117,15 +117,17 @@ impl crate::AppState {
/// Starts one real mono-route Store + Worker runtime after repeating the complete Start-time revalidation.
pub(crate) async fn start_route(&self, request: &crate::RawIngestRouteStartRequestDto) -> ksp_core_lib::Result<crate::RouteRuntimeLaunch> {
let generation = self.inventory_generation.lock();
let generation = match generation {
std::result::Result::Ok(value) => *value,
std::result::Result::Err(_) => {
return std::result::Result::Err(ksp_core_lib::Error::new(
crate::ERROR_CODE_APP_STATE_LOCK_FAILED,
"Raw Transaction Ingest Desk route inventory generation lock is poisoned",
));
},
let generation = {
let generation = self.inventory_generation.lock();
match generation {
std::result::Result::Ok(value) => *value,
std::result::Result::Err(_) => {
return std::result::Result::Err(ksp_core_lib::Error::new(
crate::ERROR_CODE_APP_STATE_LOCK_FAILED,
"Raw Transaction Ingest Desk route inventory generation lock is poisoned",
));
},
}
};
let prepared = crate::prepare_route_start(&self.config_management, generation, request);
let prepared = match prepared {

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-app-raw-transaction-ingest-desk/src/route_runtime.rs
// version: 1
// version: 2
//! Mono-route Store and Worker lifecycle owned by Raw Transaction Ingest Desk.
@@ -7,6 +7,11 @@ const ROUTE_STOP_CLEANUP_TIMEOUT: std::time::Duration = std::time::Duration::fro
const STORE_RECLAIM_POLL_INTERVAL: std::time::Duration = std::time::Duration::from_millis(5);
const STORE_RECLAIM_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(1);
struct RouteRuntimeInner {
next_sequence: u64,
slot: RouteRuntimeSlot,
}
/// Shared mono-route runtime state. `pre.008` admits at most one active or starting Worker.
pub(crate) struct RouteRuntimeState {
inner: std::sync::Mutex<RouteRuntimeInner>,
@@ -74,7 +79,7 @@ impl crate::RouteRuntimeState {
std::result::Result::Err(_) => return std::result::Result::Err(runtime_lock_error()),
};
match &inner.slot {
RouteRuntimeSlot::Starting { token } if *token == reservation.token => {},
RouteRuntimeSlot::Starting { token } if token == reservation.token => {},
RouteRuntimeSlot::Idle | RouteRuntimeSlot::Starting { .. } | RouteRuntimeSlot::Active { .. } => {
return std::result::Result::Err(ksp_core_lib::Error::new(
crate::ERROR_CODE_ROUTE_RUNTIME_STATE_INVALID,
@@ -93,7 +98,7 @@ impl crate::RouteRuntimeState {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
if matches!(&inner.slot, RouteRuntimeSlot::Starting { token: current, .. } if *current == token) {
if matches!(&inner.slot, RouteRuntimeSlot::Starting { token: current, .. } if current == token) {
inner.slot = RouteRuntimeSlot::Idle;
}
}
@@ -104,7 +109,7 @@ impl crate::RouteRuntimeState {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => return,
};
if matches!(&inner.slot, RouteRuntimeSlot::Active { token: current, .. } if *current == token) {
if matches!(&inner.slot, RouteRuntimeSlot::Active { token: current, .. } if current == token) {
inner.slot = RouteRuntimeSlot::Idle;
}
}