Closed yakkomajuri closed 3 years ago
Changing the approach from the "inline alias" required adding totalMergeAttempts
to alias
so we can bail out of what could under very rare and specific circumstances be an infinite loop. Also not super clean :D
Also had moved towards moveDistinctIds
returning a success status but I think the explicit RaceConditionError
makes sense here
@macobo this should be good for a second look
I really should put some effort into deflaking these tests ðŸ˜
Changes
Me and @macobo will probably discuss this a bit further tomorrow.
Handles 2 types of race conditions that may arise when running
mergeDistinctIds
:mergeInto
person no longer exists: this triggers an error and leaves the persons unmergedotherPerson
no longer exists: this currently does not trigger an error but leaves persons unmergedThese happen because in between the time the persons are fetched and
moveDistinctIds
is called, another thread may have deleted either of the persons. Happy to explain further.Checklist