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

Improve performance of ScanResult recording #304

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Sep 10, 2023

Description

This PR slightly improves performance of ScanResult recording in the VULNERABILITYSCAN table.

For each ScanResult we process successfully, we we update a VULNERABILITYSCAN record in the database. This merely involves incrementing of some counters in the record (total received results, total scanner results, failed scanner results, ...).

Instead of...

  • fetching the entire record from the database for every incoming ScanResult
  • modifying it in Java, and
  • updating it in DB

... use a single SQL statement, and only fetch data when the modified record is in the desired state.

Addressed Issue

N/A

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Instead of...

* fetching the entire record from the database for every incoming `ScanResult`
* modifying it in Java, and
* updating it in DB

... use a single SQL statement, and only fetch data when the modified record is in the desired state.

Signed-off-by: nscuro <[email protected]>
@nscuro nscuro added the enhancement New feature or request label Sep 10, 2023
@nscuro nscuro added this to the 5.1.0 milestone Sep 10, 2023
@VithikaS VithikaS merged commit b115c70 into main Sep 13, 2023
5 checks passed
@VithikaS VithikaS deleted the with-update-select-for-scanresult-recording branch September 13, 2023 16:27
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants