Use transaction callbacks for Vulnerabilities ES bookkeeping

What does this MR do and why?

Vulnerabilities::BulkEsOperationService was being called inside DB transactions. But this service calls redis, which is not recommended inside of a db transaction. This MR uses the transaction callbacks to handle this so that such calls are made after transaction commit. This callback mechanism was patched in !194319 (merged)

Changes -

  1. Any instance where BulkEsOperationService was being called inside a transaction is now replaced with the same but inside of an after_commit transaction callback.
  2. Any instance where BulkEsOperationService was being called in an security ingestion task is now replaced with the same but inside of an after_commit transaction callback, since security ingestion tasks run under a transaction. See note !193908 (comment 2556376394)

References

#549584 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rushik Subba

Merge request reports

Loading