HubSpot / Singularity

Scheduler (HTTP API and webapp) for running Mesos tasks—long running processes, one-off tasks, and scheduled jobs. #hubspot-open-source
http://getsingularity.com/
Apache License 2.0
821 stars 188 forks source link

API requests for pageable data should include property in response indicating additional data available #1738

Open benheng opened 6 years ago

benheng commented 6 years ago

Related to HubSpot/Singularity/pull/1706

In the above PR, the front-end is making two API requests to manually check if there exists at least 1 more item after the page, then it requests the items for the current page. It would be a lot cleaner if the back-end just returned this status as part of the response object. It doesn't even have to contain the total count, as that may have some performance implications. Just that there is at least 1 more item after the current page.

ssalinas commented 6 years ago

We have endpoints for some of these already (ones ending in withmetadata) that return a page and count along with the data. Unfortunately we've found the counting to be rather slow in SQL, so we'll likely need to find a way to speed it up before they are viable for regular use

mikebell90 commented 6 years ago

Is it feasible to ask for n + 1 objects when issuing the query? Then you don’t need a count per se