pub(crate) async fn persist_on_shutdown(shared_state: &Arc<Mutex<AppState>>)
Persist final state and any pending retries on graceful shutdown.