File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ def _cull(self, num):
125
125
else :
126
126
keep_num = num - num // self ._cull_frequency
127
127
try :
128
- # Delete from the first expiration date.
128
+ # Find the first entry beyond the retention limit,
129
+ # prioritizing earlier expiration dates.
129
130
deleted_from = next (
130
131
self .collection_for_write .aggregate (
131
132
[
@@ -137,10 +138,12 @@ def _cull(self, num):
137
138
)
138
139
)
139
140
except StopIteration :
140
- # Empty result , nothing to delete.
141
+ # No entries found beyond the retention limit , nothing to delete.
141
142
pass
142
143
else :
143
- # Remove from key.
144
+ # Delete all entries with an earlier expiration date.
145
+ # If multiple entries share the same expiration date,
146
+ # delete those with a greater or equal key.
144
147
self .collection_for_write .delete_many (
145
148
{
146
149
"$or" : [
You can’t perform that action at this time.
0 commit comments