Skip to content

Rescue from ActiveRecord::QueryCanceled

Kerri Miller requested to merge 389959-add-timeout-protections-to-mr-api into master

What does this MR do and why?

In solving #232999 (closed), we started rescuing searches that would lead to a 500 error because the result set would take too long to process. However, calls directly to the API are not being rescued and instead still return a 500 error. This change copies the pattern from https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/api/search.rb to use rescue_from ActiveRecord::QueryCanceled to catch these events and render a more friendly user response.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Related to #389959 (closed)

Merge request reports

Loading