changeset 1433:1a5410981c45

pages: get last page by default with RSM: When `max_items` is not used, Pubsub (and thus RSM) is actually returning results in chronological order. As most of time we want latest items first, `getPubsubExtra` now set `before` to get last page by default (the one with most recent items).
author Goffi <goffi@goffi.org>
date Sun, 06 Jun 2021 19:40:07 +0200
parents fa6fe9511aca
children 2f6dac783c8e
files libervia/server/pages.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/pages.py	Sun Jun 06 19:37:05 2021 +0200
+++ b/libervia/server/pages.py	Sun Jun 06 19:40:07 2021 +0200
@@ -968,6 +968,10 @@
             extra['rsm_after'] = params['after']
         elif 'before' in params:
             extra['rsm_before'] = params['before']
+        else:
+            # RSM returns list in order (oldest first), but we want most recent first
+            # so we start by the end
+            extra['rsm_before'] = ""
         return extra
 
     def setPagination(self, request, pubsub_data):