• Peter Leitzen's avatar
    Status Page: Track incident issue without subtransaction · 6a4c856c
    Peter Leitzen authored
    `StatusPage::PublishedIncident#track` used `safe_find_or_create_by` to
    circumvent a potential race condition in case of a duplicate published
    issue.  This, however, uses subtransactions under the hood which is
    problematic in nested transactions.
    
    See https://gitlab.com/groups/gitlab-org/-/epics/6540 for more context.
    
    In the rare event of `ActiveRecord::RecordNotUnique` users end up seeing
    a meaningful error message. This behaviour is acceptable and that's why
    switched to unsafe method `find_or_create_by`.
    6a4c856c
published_incident.rb 1.13 KB