refactor(sync): use shared atomic_write in OfflineQueue::save
OfflineQueue::save had its own copy of the temp-file + rename + cleanup-on-failure dance, even though the storage::atomic_write helper is pub(crate) and already used by AppConfig::save_to_file and google_tasks. Replace the inline implementation with a call to atomic_write so the crate has one canonical atomic write path. https://claude.ai/code/session_01Vk2NBZGFP3YVshDj1CwDjt
This commit is contained in:
parent
c5a3840aea
commit
80757345ab
|
|
@ -341,13 +341,7 @@ impl OfflineQueue {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let content = serde_json::to_string_pretty(self)?;
|
let content = serde_json::to_string_pretty(self)?;
|
||||||
// Atomic write: write to temp then rename
|
atomic_write(&queue_path, content.as_bytes())?;
|
||||||
let temp_path = workspace_path.join(".syncqueue.json.tmp");
|
|
||||||
std::fs::write(&temp_path, &content)?;
|
|
||||||
if let Err(e) = std::fs::rename(&temp_path, &queue_path) {
|
|
||||||
let _ = std::fs::remove_file(&temp_path);
|
|
||||||
return Err(e.into());
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue