Skip to content

Commit

Permalink
Fix issue #45
Browse files Browse the repository at this point in the history
  • Loading branch information
mchitgarha78 committed Aug 15, 2024
1 parent f58e04a commit 8a35290
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions common/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,10 @@ def save_batches_to_file(

def prune_old_batches(self, app_name: str, remove_border: int) -> None:
"""Helper function to prune old batches from memory."""
self.apps[app_name]["batches"] = {
batch["hash"]: batch
for batch in self.apps[app_name]["batches"].values()
if batch["state"] != "finalized" or batch["index"] > remove_border
}
batches = self.apps[app_name]["batches"]
for key, batch in list(batches.items()):
if batch["state"] == "finalized" and batch["index"] <= remove_border:
del batches[key]

def save_keys_to_file(self) -> None:
"""Helper function to save keys to a file."""
Expand Down

0 comments on commit 8a35290

Please sign in to comment.