Skip to content

Commit 643ea98

Browse files
committed
Fix typo that prevented old nodes cleanup
Signed-off-by: Denys Fedoryshchenko <[email protected]>
1 parent 935df2a commit 643ea98

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

api/maintenance.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def connect_to_db():
5050

5151
async def purge_old_nodes(age_days=180, batch_size=1000):
5252
"""
53-
Purge nodes from the 'nodes' collection that are older than the
53+
Purge nodes from the 'node' collection that are older than the
5454
specified number of days.
5555
5656
Args:
@@ -60,7 +60,7 @@ async def purge_old_nodes(age_days=180, batch_size=1000):
6060
"""
6161
date_end = datetime.datetime.today() - datetime.timedelta(days=age_days)
6262
db = connect_to_db()
63-
nodes = db["nodes"].find({
63+
nodes = db["node"].find({
6464
"created": {"$lt": date_end}
6565
})
6666
# We need to delete node in chunks of {batch_size}
@@ -71,11 +71,11 @@ async def purge_old_nodes(age_days=180, batch_size=1000):
7171
del_batch.append(node["_id"])
7272
if len(del_batch) == batch_size:
7373
deleted += len(del_batch)
74-
purge_ids(db, "nodes", del_batch)
74+
purge_ids(db, "node", del_batch)
7575
del_batch = []
7676
if del_batch:
7777
deleted += len(del_batch)
78-
purge_ids(db, "nodes", del_batch)
78+
purge_ids(db, "node", del_batch)
7979
db = {
8080
'response': 'ok',
8181
'deleted': deleted,

0 commit comments

Comments
 (0)