10000 Allow max_page_size to be ignored in intended cases · Issue #18 · danielhasan1/fastapi-listing · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Allow max_page_size to be ignored in intended cases #18
Closed
@danielhasan1

Description

@danielhasan1

max_page_size: a limiter provided in API implementation that stops clients from requesting absurd page sizes.

But there are some cases where the limiter can instead of saving the API performance can destroy the database performance.

Lets take an example:
I have a listing API of orders where max_page_size=100
A user can call this API and fetch upto 100 items per page if they tried to request more than that the limiter will not allow them to fetch more than 100 items on a single page.
Now lets say we are trying to use the same API where a user wanna download data for some sort of processing and there are 1 millions rows imagine the API trying to connect to db fetching 100 items per page for 1 million rows.

to solve this we can implement a logic in our listing API implementation and set some sort of flag that will tell core library to ignore the limiter check. On each API call that logic will run and if we wanna avoid the limiter and sorter(becuase db optimiser can decide to apply file sort) then we can do it at API level.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0