Skip to content

Commit

Permalink
Use limit=0 in query to retrieve just the results metadata [MA-101]
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgarwood authored and nikhiltri committed Aug 9, 2023
1 parent aedeafb commit c70c5b6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion app/Libraries/Api/Builders/ApiQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public function getRaw($columns = [], $endpoint = null)
*/
public function count($endpoint = null): int
{
return $this->forPage(1, 1)->get([], $endpoint)->getMetadata('pagination')->total;
return $this->limit(0)->get([], $endpoint)->getMetadata('pagination')->total;
}

public function getPaginationData()
Expand Down
1 change: 0 additions & 1 deletion app/Libraries/Api/Builders/Connection/AicConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ public function execute($endpoint = null, $params = [])
$response = $this->client->request($verb, $endpoint, $options);
if (config('api.logger')) {
\Log::info('cache ttl = ' . $ttl . ' seconds');
\Log::info(print_r((array) $response->body, true));
}
return $response;
});
Expand Down

0 comments on commit c70c5b6

Please sign in to comment.