-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust re-write dropped some metadata keys of paginated response #11
Comments
I tried fixing this issue by adding the following lines:
The problem is that in |
@ayalash how critical are the "total_num_objects" and "total_num_pages"? They are expensive to produce database-wise... |
@vmalloc the "total_num_objects" itself is not critial, but as long as our metadata contains only "page" and "page_size" we cannot know if there are more results or not. |
When you get less than page_size results per page, you reached the end... |
And when the results is multiple of "page_size", you should continue (extra API) until the page will be empty? |
Yes. That's how most "streaming" APIs work. I can also provide a "has next page" attribute to save that extra page fetch. However providing the total number of objects is expensive because it often requires a full database scan... |
Backslash API has "has_more" metadata. I think that if we'll have a similar flag it is enough :) |
Ok. I'll add it. |
Thanks |
@ayalash develop has the fix already - let me know if it's working ok so that I can publish a release. |
From the (old) Python implementation of mailboxer
While
paginated_view
is fromweber_utils
package adding the following fields to the metadata of these views: page, page_size, total_num_objects, total_num_pageshttps://github.com/vmalloc/weber-utils/blob/master/weber_utils/pagination.py#L9-L32
The rust implementation is lacking these fields. For example:
The text was updated successfully, but these errors were encountered: