diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 375bc76e3..cbfb5de55 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -2029,6 +2029,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) } // if we found a "boring" node, evict it if (oldestBoringIndex != -1) { + evictedAge = sinceLastSeen(&meshNodes->at(oldestBoringIndex)); oldestIndex = oldestBoringIndex; } @@ -2040,6 +2041,7 @@ meshtastic_NodeInfoLite *NodeDB::getOrCreateMeshNode(NodeNum n) (numMeshNodes)--; } } + LOG_WARN("Evicted node %u secs old", evictedAge); // add the node at the end lite = &meshNodes->at((numMeshNodes)++); diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index adf2b42ea..4c43f267b 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -307,7 +307,10 @@ class NodeDB newStatus.notifyObservers(&status); } + uint32_t get_evicted_age() { return evictedAge; } + private: + uint32_t evictedAge = UINT32_MAX; bool duplicateWarned = false; bool localPositionUpdatedSinceBoot = false; uint32_t lastNodeDbSave = 0; // when we last saved our db to flash