Memory optimisations

This commit is contained in:
Mark Qvist 2025-01-21 16:44:24 +01:00
parent 44d1d992f8
commit bfed126a7c

View file

@ -358,14 +358,14 @@ class LXMPeer:
@property @property
def handled_messages(self): def handled_messages(self):
pes = self.router.propagation_entries.copy() pes = self.router.propagation_entries.copy()
hm = list(filter(lambda tid: self.destination_hash in self.router.propagation_entries[tid][4], pes)) hm = list(filter(lambda tid: self.destination_hash in pes[tid][4], pes))
self._hm_count = len(hm); del pes self._hm_count = len(hm); del pes
return hm return hm
@property @property
def unhandled_messages(self): def unhandled_messages(self):
pes = self.router.propagation_entries.copy() pes = self.router.propagation_entries.copy()
um = list(filter(lambda tid: self.destination_hash in self.router.propagation_entries[tid][5], pes)) um = list(filter(lambda tid: self.destination_hash in pes[tid][5], pes))
self._um_count = len(um); del pes self._um_count = len(um); del pes
return um return um