feat(#2635): consolidate todos + reminders into one hyperhive-state.sqlite
This commit is contained in:
parent
64a14718fe
commit
c316dc852d
3 changed files with 261 additions and 7 deletions
|
|
@ -10,6 +10,7 @@
|
|||
//! before lib + bin were collapsed into one) plus the serve loop.
|
||||
|
||||
mod client;
|
||||
mod db_migrate;
|
||||
mod events;
|
||||
mod forge_notify;
|
||||
mod harness_state;
|
||||
|
|
@ -467,6 +468,19 @@ async fn serve_main<S: Surface>(socket: &Path, poll_ms: u64) -> Result<()> {
|
|||
// never observes a "closed" state. Opened before the todo socket
|
||||
// below so the same `Arc` can be handed to its request dispatch
|
||||
// (reminder ops share the todo socket/listener).
|
||||
// Fold the pre-consolidation per-concern db files into the single
|
||||
// `hyperhive-state.sqlite`, if this is the first boot since the
|
||||
// upgrade — see `db_migrate` module docs. Best-effort: a failure here
|
||||
// just leaves the legacy file(s) in place to retry next boot, so the
|
||||
// subsystems below still start (`Todos`/`Reminders::open` create the
|
||||
// schema fresh if nothing migrated across).
|
||||
if let Err(e) = db_migrate::run(
|
||||
&paths::state_db(),
|
||||
&paths::legacy_todos_db(),
|
||||
&paths::legacy_reminders_db(),
|
||||
) {
|
||||
tracing::warn!(error = ?e, "legacy db_migrate failed — continuing with fresh/partial state db");
|
||||
}
|
||||
let (reminder_tx, reminder_rx) = tokio::sync::mpsc::unbounded_channel();
|
||||
let reminder_store = match reminders::Reminders::open(&paths::reminders_db()) {
|
||||
Ok(store) => Some(Arc::new(store)),
|
||||
|
|
|
|||
Loading…
Reference in a new issue