MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / flush_pending

Function flush_pending

atomic-agent/src/hook_log.rs:222–233  ·  view source on GitHub ↗

Replay pending events idempotently while the service owns the database gate.

(
    root: &std::path::Path,
    store: &atomic_repository::redb_change_store::RedbChangeStore,
)

Source from the content-addressed store, hash-verified

220
221/// Replay pending events idempotently while the service owns the database gate.
222pub fn flush_pending(
223 root: &std::path::Path,
224 store: &atomic_repository::redb_change_store::RedbChangeStore,
225) -> Result<(), String> {
226 for (path, event) in pending(root)? {
227 store
228 .append_session_log(&event)
229 .map_err(|error| error.to_string())?;
230 let _ = std::fs::remove_file(path);
231 }
232 Ok(())
233}
234
235#[cfg(test)]
236mod tests {

Calls 2

pendingFunction · 0.85
append_session_logMethod · 0.80