Persist only contacts to flash, mark on send/receive

Only destinations that have exchanged messages are written to SPIFFS.
UIManager marks destinations as persistent on send_message() and
on_message_received(). Reduces persist time from 40-50s to <1s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
torlando-tech
2026-02-23 13:17:28 -05:00
parent e343caf2d2
commit 4e1f379d94
2 changed files with 7 additions and 1 deletions

View File

@@ -593,6 +593,9 @@ void UIManager::send_message(const Bytes& dest_hash, const String& content) {
std::string msg = "Sending message to " + hash_hex + "...";
INFO(msg.c_str());
// Mark recipient as a persistent contact (survives reboot)
Identity::mark_persistent(dest_hash);
// Get our source destination (needed for signing)
Destination source = _router.delivery_destination();
@@ -645,6 +648,9 @@ void UIManager::on_message_received(::LXMF::LXMessage& message) {
std::string msg = "Message received from " + source_hex + "...";
INFO(msg.c_str());
// Mark sender as a persistent contact (survives reboot)
RNS::Identity::mark_persistent(message.source_hash());
// Save to store
_store.save_message(message);