Copy poslist items before deleting to avoid RuntimeError

This commit is contained in:
Jared Dulmage 2020-05-05 14:22:20 -06:00
parent 9dc3367aaf
commit 5f7c6f57c8

View File

@ -193,11 +193,11 @@ class cpr_decoder:
def weed_poslists(self): def weed_poslists(self):
for poslist in [self.evenlist, self.oddlist]: for poslist in [self.evenlist, self.oddlist]:
for key, item in poslist.items(): for key, item in tuple(poslist.items()):
if time.time() - item[2] > 10: if time.time() - item[2] > 10:
del poslist[key] del poslist[key]
for poslist in [self.evenlist_sfc, self.oddlist_sfc]: for poslist in [self.evenlist_sfc, self.oddlist_sfc]:
for key, item in poslist.items(): for key, item in tuple(poslist.items()):
if time.time() - item[2] > 25: if time.time() - item[2] > 25:
del poslist[key] del poslist[key]