Compare commits

...

1 Commits

Author SHA1 Message Date
Jonathan Bennett
b056c405e6 Add evicted age and accessor in NodeDB 2026-01-18 22:16:20 -06:00
2 changed files with 5 additions and 0 deletions

View File

@@ -2029,6 +2029,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
} }
// if we found a "boring" node, evict it // if we found a "boring" node, evict it
if (oldestBoringIndex != -1) { if (oldestBoringIndex != -1) {
evictedAge = sinceLastSeen(&meshNodes->at(oldestBoringIndex));
oldestIndex = oldestBoringIndex; oldestIndex = oldestBoringIndex;
} }
@@ -2040,6 +2041,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n)
(numMeshNodes)--; (numMeshNodes)--;
} }
} }
LOG_WARN("Evicted node %u secs old", evictedAge);
// add the node at the end // add the node at the end
lite = &meshNodes->at((numMeshNodes)++); lite = &meshNodes->at((numMeshNodes)++);

View File

@@ -307,7 +307,10 @@ class NodeDB
newStatus.notifyObservers(&status); newStatus.notifyObservers(&status);
} }
uint32_t get_evicted_age() { return evictedAge; }
private: private:
uint32_t evictedAge = UINT32_MAX;
bool duplicateWarned = false; bool duplicateWarned = false;
bool localPositionUpdatedSinceBoot = false; bool localPositionUpdatedSinceBoot = false;
uint32_t lastNodeDbSave = 0; // when we last saved our db to flash uint32_t lastNodeDbSave = 0; // when we last saved our db to flash