Optimize calclulation of self-made marks
Previously self-made marks were re-calculated every time on post-processing. This made sense in order to not require re-read of all reviews. Now, change the processing to time of reading. Change-Id: I9e96f329b1b4474ea5602d3b0903b64c63e6c530
This commit is contained in:
parent
8cbbdf626b
commit
43201e79a9
@ -396,6 +396,10 @@ class RecordProcessor(object):
|
||||
mark['review_id'] = review['id']
|
||||
mark['patch'] = int(patch['number'])
|
||||
|
||||
if reviewer['username'] == patch['uploader'].get('username'):
|
||||
# reviewer is the same as author of the patch
|
||||
mark['type'] = 'Self-%s' % mark['type']
|
||||
|
||||
self._update_record_and_user(mark)
|
||||
return mark
|
||||
|
||||
@ -818,23 +822,6 @@ class RecordProcessor(object):
|
||||
}]
|
||||
user_processor.store_user(self.runtime_storage_inst, user)
|
||||
|
||||
def _update_self_made_marks(self):
|
||||
LOG.info('Update self-made marks')
|
||||
patch_id_to_user_id = {}
|
||||
for record in self.runtime_storage_inst.get_all_records():
|
||||
if record['record_type'] == 'patch':
|
||||
patch_id_to_user_id[record['primary_key']] = record['user_id']
|
||||
|
||||
for record in self.runtime_storage_inst.get_all_records():
|
||||
if record['record_type'] != 'mark':
|
||||
continue
|
||||
|
||||
patch_id = utils.get_patch_id(record['review_id'], record['patch'])
|
||||
if record['user_id'] == patch_id_to_user_id.get(patch_id):
|
||||
if record['type'][:5] != 'Self-':
|
||||
record['type'] = 'Self-%s' % record['type']
|
||||
yield record
|
||||
|
||||
def post_processing(self, release_index):
|
||||
self.runtime_storage_inst.set_records(
|
||||
self._update_records_with_user_info())
|
||||
@ -856,5 +843,3 @@ class RecordProcessor(object):
|
||||
|
||||
self.runtime_storage_inst.set_records(
|
||||
self._update_members_company_name())
|
||||
|
||||
self.runtime_storage_inst.set_records(self._update_self_made_marks())
|
||||
|
Loading…
x
Reference in New Issue
Block a user