-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting MaxItems to a low value when calling ZonesListAll may drastically reduce performance. #47
Comments
@com-m I started looking at this issue in case i can fix it up for Hacktoberfest2020, but i think there is a misunderstanding about the functionality, and want to make sure this isn't actually working as designed already. In looking @ the VinylDNS API specification I see this:
In the golang client code, i see that the description of the ZonesListAll function is commented as follows:
So the maxItems flag appears to only matter for paginating the API to collect the records, while the golang client will always pull all zones. If you use |
This seems like it's working as it was designed, but that design leaves something to be desired. I would expect MaxItems to limit the number of items returned, not control the internal (hidden) pagination. It seems to be a pattern repeated with the Lines 172 to 177 in 148a5f6
We either need to not allow the user to affect the page size, or actually limit the number of results returned. Perhaps we can add a go-vinyldns/vinyldns/resources.go Lines 45 to 51 in 148a5f6
@mdb What do you think about this. I don't want to break backward compatibility, so we'd need to default |
@remerle Apologies for the delayed response, here.
Yes; I agree with this assessment. the
I think this sounds reasonable, assuming there isn't ever a scenario where a |
Expected Behavior:
Function quickly returns with an array no greater in length than the maxItems parameter
Actual Behavior:
If the server response contains a "nextID" field, and the number of potential responses is high for the given query, the function will continually make requests to the server
maxItems
at a time until all potential responses have been exhausted. This can result in ZoneListAll taking an extended period of time to return, and eventually returning an array longer than the maxItems parameter.How to reproduce:
Run unit tests for the zone functions in the client, mocking a backend that sends the appropriate test fixtures for the request.
If maxItems is set to 1, two requests will be sent and two items will be returned in the array instead of one.
The text was updated successfully, but these errors were encountered: