Merge pull request 'Logs: a total only when it's known, not the query cap' (#117) from fix/log-query-total into main
This commit was merged in pull request #117.
This commit is contained in:
@@ -146,6 +146,15 @@ pub(crate) async fn log_query(
|
||||
})?;
|
||||
response.anchor_found = true;
|
||||
|
||||
// inbuxa: the total is only known when the first page reached the end
|
||||
// of the logs; counting them all would mean reading every file on every
|
||||
// page. Upstream answered the query cap (5000) as the total, so a
|
||||
// two-line log read "of 5000".
|
||||
response.response.total = (req.request.calculate_total.unwrap_or(false)
|
||||
&& anchor == 0
|
||||
&& response.response.ids.len() < limit)
|
||||
.then_some(response.response.ids.len());
|
||||
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user