-
Notifications
You must be signed in to change notification settings - Fork 27
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
Project pagination (backend) #2268
Project pagination (backend) #2268
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2268 +/- ##
======================================
Coverage 71.5% 71.6%
======================================
Files 486 488 +2
Lines 19270 19286 +16
Branches 1902 1897 -5
======================================
+ Hits 13792 13817 +25
+ Misses 5015 5007 -8
+ Partials 463 462 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
73a8ce7
to
e4cd7a5
Compare
105f799
to
55f2356
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Just some suggestions!
packages/service-library/src/servicelib/rest_pagination_utils.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/projects/project_models.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/projects/projects_db.py
Outdated
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/projects/projects_db.py
Show resolved
Hide resolved
services/web/server/src/simcore_service_webserver/projects/projects_handlers.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's say this will be used to paginate the files in storage (which can easily be composed of thousands of elements).
Would it not be better to have a more simpler pagination method which dose not need to scroll over the entire dataset (each time I a page of data is requested). In my opinion this pagination method, only solves the problem half way. The backend will get even more load now.
I think that by leveraging the SQL LIMIT command this would be much more efficient. This will properly implement infinte scrolling. You never have any idea what the entire dataset length is, except when you hit the last page and you no longer have any "next page" links.
No for this I would not use limit/offset pagination but cursor based. see here or here for all the different kinds of paginations.
I am not sure I understand what you mean by "need to scroll over the entire dataset" and "the backend will get more load now"?
which is I think precisely what is implemented... see test_projects_01.py and let me know what I am missing here... even the test does call next link... |
OK
I was trying to say that if there are 7 projects, and pagination api lists 4 projects per page. The api will be called 2 times, once will return the first 4 projects and the second time it will return the last 3 projects. In both situation the backend will fetch from the database all 7 projects.
OK (minor thing: here you already know and expect the size of the dataset, but it's fine for now) |
No. This is a webAPI. and the problem is not arising with 7 projects but more so when you get over 100 projects.
Yes I always know the size of the dataset (e.g. the number of projects a user can see). But why would I return all of it if the frontend does not need it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I'm fine with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works like a charm
a97c530
to
618e5bb
Compare
fix usage of offset. it's not a page
What do these changes do?
Bonus: removed some very old things.
Related issue/s
How to test
Checklist