mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
fix(store): keep shared slatedb open across run handles
After the single-DB refactor, closing one SlateRunStore could close the shared SlateDB for every run in the process. Under shared-daemon test load that surfaced as 500 responses with \"db is closed\" on later state, event, and delete requests. Make run-handle close a no-op so the shared DB lifetime stays owned by the store/process rather than individual run handles.
This commit is contained in:
parent
2889d5b2c2
commit
dcbc104c99
1 changed files with 2 additions and 10 deletions
|
|
@ -6,7 +6,7 @@ use bytes::Bytes;
|
|||
use chrono::Utc;
|
||||
use futures::Stream;
|
||||
use serde::de::DeserializeOwned;
|
||||
use slatedb::{CloseReason, Db, DbRead, ErrorKind};
|
||||
use slatedb::{Db, DbRead};
|
||||
use tokio::sync::{Mutex, broadcast, mpsc};
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
|
||||
|
|
@ -117,15 +117,7 @@ impl SlateRunStore {
|
|||
|
||||
pub(crate) async fn close(&self) -> Result<()> {
|
||||
let _guard = self.inner.close_lock.lock().await;
|
||||
if Arc::strong_count(&self.inner) <= 1 {
|
||||
match self.inner.db.close().await {
|
||||
Ok(()) => Ok(()),
|
||||
Err(err) if matches!(err.kind(), ErrorKind::Closed(CloseReason::Clean)) => Ok(()),
|
||||
Err(err) => Err(err.into()),
|
||||
}
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn validate_init<R>(db: &R, run_id: &RunId) -> Result<bool>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue