Skip to content
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

REST API wrong behaviour #5207

Open
vladbogo opened this issue Feb 23, 2020 · 3 comments
Open

REST API wrong behaviour #5207

vladbogo opened this issue Feb 23, 2020 · 3 comments

Comments

@vladbogo
Copy link
Contributor

Hi,

I have a question regrading the REST API. We are trying to get a list of the last changes for a particular branch.

However, using https://buildbot.mariadb.org/api/v2/changes?branch=10.1&order=-changeid&limit=10 does not return the last 10 changes for the 10.1 branch. Is this the expected behaviour? Based on the documentation I would assume that this would return the last 10 changes for branch 10.1. If the limit argument is increased, more changes start to appear.

Things get a lot more confusing when deleting the "order" argument https://buildbot.mariadb.org/api/v2/changes?branch=10.1&limit=10 when the request times out and the buildbot is unresponsive for several minutes. Any thoughts on this? Is there any sort of cache used?

Thanks!

@vladbogo
Copy link
Contributor Author

vladbogo commented Mar 5, 2020

Any updates?

@tardyp
Copy link
Member

tardyp commented Mar 5, 2020

Indeed, this is a bug, we do not support limit and filtering with the current code.

as per this code, the limit is done here, but only when order is -changeid

changes = yield self.master.db.changes.getRecentChanges(resultSpec.limit)

This should rather be implemented like in the builds endpoint:

builds = yield self.master.db.builds.getBuilds(

where resultSpec is passed to the db api

and then used with a generic database query generation

return resultSpec.thd_execute(conn, q, self._builddictFromRow)

would you like to fix this code?

@vladbogo
Copy link
Contributor Author

vladbogo commented Mar 6, 2020

Thanks for your answer. I will look into it and try to fix it.

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

No branches or pull requests

2 participants