Skip to content

Commit

Permalink
Merge branch '1043' into 2033-merge-forward
Browse files Browse the repository at this point in the history
Conflicts:
	server/pulp/server/managers/repo/publish.py
	server/pulp/server/managers/repo/sync.py
  • Loading branch information
asmacdo committed Sep 17, 2015
2 parents 9396e22 + cb50793 commit 9f9dc3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion server/pulp/server/webservices/views/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,11 @@ def _process_entries(cursor, sort, limit):
:return: sorted, limited list of entries
:rtype: list
"""
cursor.sort('started', direction=constants.SORT_DIRECTION[sort])

# Sort the results by the ObjectId field, which will effectively sort based on the start
# time of the event. This way of sorting is preferred because for a sufficiently large data
# set, the sort field must be an indexed field.
cursor.sort('_id', direction=constants.SORT_DIRECTION[sort])
if limit is not None:
cursor.limit(limit)
return list(cursor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ def test_process_entries(self):
mock_cursor = mock.MagicMock()
history = HistoryView()
result = history._process_entries(mock_cursor, constants.SORT_DESCENDING, 3)
mock_cursor.sort.assert_called_once_with('started', direction=-1)
mock_cursor.sort.assert_called_once_with('_id', direction=-1)
mock_cursor.limit.assert_called_once_with(3)
self.assertTrue(isinstance(result, list))

Expand Down

0 comments on commit 9f9dc3a

Please sign in to comment.