Skip to content

Commit

Permalink
flowctl: change pagination check to include result sizes >= requested…
Browse files Browse the repository at this point in the history
… page size, as PostgREST appears to be sometimes returning more rows than was requested.
  • Loading branch information
jshearer committed Sep 17, 2024
1 parent 29702a5 commit 9e50e5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/flowctl/src/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ where
) -> PageTurnerOutput<Self, PaginationRequest> {
let resp: Vec<Item> = api_exec::<Vec<Item>>(request.builder.clone()).await?;

if resp.len() == request.page_size
// Sometimes, it seems, we can get back more than the requested page size.
// So far I've only seen this on a request of 1,000 and a response of 1,001.
if resp.len() >= request.page_size
// If the original builder had a limit set to the same value as page_size
// this ensures that we stop right at the limit, instead of issuing an extra
// request for 0 rows.
Expand Down

0 comments on commit 9e50e5f

Please sign in to comment.