Skip to content

Commit d9e8834

Browse files
committed
Remove hardcoded value
1 parent 0c4262e commit d9e8834

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

django_mongodb_backend/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.core.cache.backends.db import Options
66
from django.db import connections, router
77
from django.utils.functional import cached_property
8-
from pymongo import IndexModel, ReturnDocument
8+
from pymongo import ASCENDING, DESCENDING, IndexModel, ReturnDocument
99
from pymongo.errors import DuplicateKeyError, OperationFailure
1010

1111

@@ -129,7 +129,7 @@ def _cull(self, num):
129129
deleted_from = next(
130130
self.collection_for_write.aggregate(
131131
[
132-
{"$sort": {"expires_at": -1, "key": 1}},
132+
{"$sort": {"expires_at": DESCENDING, "key": ASCENDING}},
133133
{"$skip": keep_num},
134134
{"$limit": 1},
135135
{"$project": {"key": 1, "expires_at": 1}},

0 commit comments

Comments
 (0)