Repository navigation
fix: delete the duplicate event when a parallel sync already tracks it - #1055
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: two syncs can create the same calendar event in parallel. The second sync inserts its event at Google or Microsoft, and then its tracking row fails.
CourseCalendars::Provider#create_eventrescued onlyActiveRecord::RecordNotUnique. When the other sync's row was already committed, the uniqueness validation raisedRecordInvalidfirst. The sync then failed, and the event it had just inserted stayed as a duplicate in the student's calendar. The tests pass (#1054) found this. It left a pending spec for it.What changes
create_eventandcreate_friend_meeting_eventshare one helper,track_new_event. OnRecordNotUnique, or onRecordInvalidwith:takenon a source column, the helper deletes the duplicate it just inserted. It keeps the other sync's row and reports the error as handled (ids only). Other validation errors still raise.sendUpdates=all, so the invited friends get the cancellation. Microsoft Graph already cancels.skipped, notcreated. A recreate that loses it also counts asskipped.Checks
CI=1passed: 6659 examples, 0 failures. Line coverage is 96.18% and branch coverage is 86.29%.RecordNotUniquepath, a failed delete, a validation error that must still raise, the stats, and the friend-meeting race on Google (with and without invitations) and Microsoft.