Skip to content

Paginate group fetching and reduce batch size to 500#220

Merged
rvanoord merged 2 commits intomasterfrom
copilot/check-group-retrieval-limit
Apr 15, 2026
Merged

Paginate group fetching and reduce batch size to 500#220
rvanoord merged 2 commits intomasterfrom
copilot/check-group-retrieval-limit

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

fetch_groups() and fetch_groups_by_tag() had a hard limit=1000 with no pagination—any groups beyond that were silently dropped.

  • Added offset-based pagination to both fetch_groups() and fetch_groups_by_tag() so all matching groups are retrieved regardless of count
  • Reduced batch size from 1000 to 500 per API request
$limit = 500;
$offset = 0;
$all_data = [];

do {
    $response = wp_remote_get(".../groups?limit=$limit&offset=$offset&fields=uid,name,tags&filter=$qry", ...);
    $data = json_decode($response['body'])->data;
    $all_data = array_merge($all_data, $data);
    $offset += $limit;
} while (count($data) === $limit);

Copilot AI and others added 2 commits April 15, 2026 09:32
@rvanoord rvanoord marked this pull request as ready for review April 15, 2026 11:14
@rvanoord rvanoord merged commit aa97879 into master Apr 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants