plugins.py: Set an explicit limit to avoid the index default limit

plugins.py lists projects via the List Projects REST endpoint [1]
without paginating over the results. For Gerrit servers at Google we
are replacing the implementation of the List Projects REST endpoint with
a wrapper that forwards requests to Query Projects [2]. When we do this
query limits will be applied (1. the max limit that is permitted for the
calling user [3], 2. the index default limit that was added by [4]). The
index default limit will be set to 100 for us. This means requests that
do not specify an explicit limit will received only 100 results by
default. For plugins.py this means it will only get the first 100 plugin
projects. Since there are ~150 plugin projects it would miss some
results. To prevent this set 500 as an explicit limit. If an explicit
limit is set the index default limit (100) is not applied, but only the
maximum allows limit is applied (500 by default). This means by setting
limit=500 we should get 500 results which is good enough for now, but
this will break when the number of plugin projects grows beyond 500.
Fixing this is tracked by Issue 296837507.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-projects
[2] https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#query-projects
[3] https://gerrit-review.googlesource.com/Documentation/access-control.html#capability_queryLimit
[4] https://gerrit-review.googlesource.com/c/gerrit/+/380955

Change-Id: Icba2de15479478dead8043fbabab1e139fda8e55
Signed-off-by: Edwin Kempin <ekempin@google.com>
Bug: Issue 296837507
1 file changed