Ensure protected branches audit event even if cache refresh fails

What does this MR do and why?

We had an issue where a protected branch was successfully destroyed, yet no audit event was present.

We were not able to reproduce the issue locally, as the happy path successfully results in an audit event being logged.

It was noticed that, if a cache refresh was to fail, we could end up in this state where the protected branch was deleted and no audit event was logged.

This change rescues runtime errors around the cache refresh to prevent this hypothetical from occurring

resolves: #363509 (closed)

How to set up and validate locally

not really applicable. CI passing is a good enough test. Potentially

  1. remove added rescue code
  2. run specs, see failure
  3. add back new code
  4. run specs, see success

more details can be seen in the notes in the linked issue

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading