Skip to content

Commit

Permalink
Merge pull request #5509 from p12tic/2.8-changes
Browse files Browse the repository at this point in the history
2.8: Fix bad fieldMapping in change data endpoint
  • Loading branch information
p12tic committed Aug 29, 2020
2 parents fc96083 + c660f50 commit 4a656cd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/data/changes.py
Expand Up @@ -41,7 +41,7 @@ def _fixChange(self, change):
del change['sourcestampid']
return change
fieldMapping = {
'changeid': 'changes.id',
'changeid': 'changes.changeid',
}


Expand Down
1 change: 1 addition & 0 deletions master/buildbot/newsfragments/datachanges.bugfix
@@ -0,0 +1 @@
fix 100% CPU on large installs when looking using the changes api (:issue:`5504`)
3 changes: 2 additions & 1 deletion master/buildbot/test/unit/test_db_changes.py
Expand Up @@ -19,6 +19,7 @@
from twisted.trial import unittest

from buildbot.data import resultspec
from buildbot.data.changes import FixerMixin
from buildbot.db import builds
from buildbot.db import changes
from buildbot.db import sourcestamps
Expand Down Expand Up @@ -277,7 +278,7 @@ def insert7Changes(self):
def test_getChanges_subset(self):
yield self.insert7Changes()
rs = resultspec.ResultSpec(order=['-changeid'], limit=5)
rs.fieldMapping = {'changeid': 'changes.changeid'}
rs.fieldMapping = FixerMixin.fieldMapping
changes = yield self.db.changes.getChanges(resultSpec=rs)
changeids = [c['changeid'] for c in changes]
self.assertEqual(changeids, [10, 11, 12, 13, 14])
Expand Down

0 comments on commit 4a656cd

Please sign in to comment.