repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

fix: lock the catalog with let-else

abb9c85e81c1f216e9fb164b26c375009422fa90

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (1)

+5 / −8 text lines

Diff layout

smith-ai/src/refresh.rs

Modified

+5 / −8 text lines

116116 if fetched_generation <= published {
117117 return Ok(RefreshOutcome::StaleDiscarded);
118118 }
119 let mut guard = match state.inner.lock() {
120 Ok(guard) => guard,
121 Err(_) => {
122 return Err(smith::error::SmithError::Session {
123 code: "CATALOG_LOCK_POISONED".to_string(),
124 message: "catalog state lock poisoned".to_string(),
125 });
126 }
119 let Ok(mut guard) = state.inner.lock() else {
120 return Err(smith::error::SmithError::Session {
121 code: "CATALOG_LOCK_POISONED".to_string(),
122 message: "catalog state lock poisoned".to_string(),
123 });
127124 };
128125 // Re-check under the lock: only the newest generation may publish.
129126 if fetched_generation <= guard.generation {