Skip to content

Commit

Permalink
Merge pull request #181 from becantwell/timeline-filter
Browse files Browse the repository at this point in the history
Fix 'OrderedDict mutated during iteration' error with python 3
  • Loading branch information
Mani-D authored Oct 1, 2024
2 parents 6fb63e3 + cfc0674 commit d50e95f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/lib/xpedite/analytics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,18 @@ def filterTxns(repo, txnFilter):
"""
totalFilteredCount = 0
for txnCollection in repo.getTxnCollections():
txnMap = txnCollection.txnMap
txnMap = {}
filteredCount = 0
unfilteredCount = len(txnMap)
for tid, txn in txnMap.items():
for tid, txn in txnCollection.txnMap.items():
if not txnFilter(txnCollection.name, txn):
del txnMap[tid]
filteredCount += 1
else:
txnMap[tid] = txn
if filteredCount:
LOGGER.debug('filtering txns from \"%s\" - removed %d out of %d',
txnCollection.name, filteredCount, unfilteredCount
)
totalFilteredCount += filteredCount
txnCollection.txnMap = txnMap
return totalFilteredCount

0 comments on commit d50e95f

Please sign in to comment.