Skip to content

Commit

Permalink
[feat] Make report annotations compatible with store speedup
Browse files Browse the repository at this point in the history
By moving the the additon of annotations from the add_report method to
the add_report_context method (and removing the flush from the handler
function), the same session flushing strategy was restored.
  • Loading branch information
vodorok committed Mar 23, 2023
1 parent df4ad0f commit 4055ffd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions web/server/codechecker_server/api/mass_store_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,10 @@ def __add_report_context(self, session, file_path_to_id):
macro.message, file_path_to_id[macro.file.path],
db_report.id, data_type))

if report.annotations:
self.__validate_and_add_report_annotations(
session, db_report.id, report.annotations)

session.flush()

except Exception as ex:
Expand Down Expand Up @@ -982,9 +986,6 @@ def get_missing_file_ids(report: Report) -> List[str]:
rs_from_source, detection_status, detected_at,
run_history_time, analysis_info, analyzer_name, fixed_at)

if report.annotations:
self.__validate_and_add_report_annotations(
session, report_id, report.annotations)
self.__new_report_hashes[report.report_hash] = \
rs_from_source.status
self.__already_added_report_hashes.add(report_path_hash)
Expand Down Expand Up @@ -1038,8 +1039,6 @@ def __validate_and_add_report_annotations(
f"'{ALLOWED_ANNOTATIONS[key]['display']}'."
)

session.flush()

def __store_reports(
self,
session: DBSession,
Expand Down

0 comments on commit 4055ffd

Please sign in to comment.