Skip to content

Commit

Permalink
set explicit sorting on archive expiry (#2387)
Browse files Browse the repository at this point in the history
SDESK-6614
  • Loading branch information
petrjasek committed Oct 17, 2022
1 parent 5cd3ab9 commit 3b0e44a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions superdesk/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

import pymongo
import logging

from typing import Dict, Any, Union
from typing import Dict, Any, Optional, Union
from flask import current_app as app, json
from eve.utils import ParsedRequest, config
from eve.methods.common import resolve_document_etag
Expand All @@ -28,7 +29,7 @@ class BaseService:

datasource: Union[str, None]

def __init__(self, datasource: str = None, backend=None):
def __init__(self, datasource: Optional[str] = None, backend=None):
self.backend = backend
self.datasource = datasource

Expand Down Expand Up @@ -202,7 +203,7 @@ def delete_action(self, lookup=None):
lookup = {}
docs = []
else:
docs = list(doc for doc in self.get_from_mongo(None, lookup))
docs = list(doc for doc in self.get_from_mongo(None, lookup).sort("_id", pymongo.ASCENDING))
for doc in docs:
self.on_delete(doc)
res = self.delete(lookup)
Expand Down

0 comments on commit 3b0e44a

Please sign in to comment.