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

divide number of sql queries for getPrevSuccessfulBuild() by 100 #4920

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions master/buildbot/db/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def getPrevSuccessfulBuild(self, builderid, number, ssBuild):
rv = None
tbl = self.db.model.builds
offset = 0
increment = 1000
matchssBuild = {(ss['repository'],
ss['branch'],
ss['codebase']) for ss in ssBuild}
Expand All @@ -81,7 +82,7 @@ def getPrevSuccessfulBuild(self, builderid, number, ssBuild):
(tbl.c.number < number) &
(tbl.c.results == 0)),
offset=offset,
limit=10)
limit=increment)
if not prevBuilds:
break
for prevBuild in prevBuilds:
Expand All @@ -93,7 +94,7 @@ def getPrevSuccessfulBuild(self, builderid, number, ssBuild):
# repository/branch/codebase was found !
rv = prevBuild
break
offset += 10
offset += increment

return rv

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduced the number of SQL queries triggered by ``getPrevSuccessfulBuild()`` by up to 100.