Implement multiple-object coalescing for review replies.
Review Request #12200 — Created March 22, 2022 and submitted
In Review Board, a pending review object or pending reply object is
intended to be unique to each user (that is, a user may only have one
pending reply to a given review at a time). Unfortunately, we do hit
cases where network lag, overloaded webservers, or slow databases can
create situations where multiple API requests come in and end up
creating multiple objects. This then results in errors about
MultipleObjectsReturned
when attempting to fetch later.We already have logic for reviews to detect this situation and coalesce
duplicates into a single review. This change implements something very
similar for pending review replies, leveraging the same coalescing
logic.
Ran unit tests. Before the fix, this would hit the
MultipleObjectsReturned error. After, the new test passes successfully.