Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defer link import if the revision has multiple link updates #1088

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Defer link import if the revision has multiple link updates
Alexander-Hjelm authored Dec 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 6a2f92acc1a6d603f9648bf923794bda222e5c14
10 changes: 9 additions & 1 deletion src/WorkItemMigrator/WorkItemImport/Agent.cs
Original file line number Diff line number Diff line change
@@ -664,8 +664,9 @@ private bool ApplyAndSaveLinks(WiRevision rev, WorkItem wi, Settings settings)
saveLinkTimestamp = saveLinkTimestamp.AddMilliseconds(2);
}

foreach (var link in rev.Links)
for (int i = 0; i < rev.Links.Count; i++)
{
var link = rev.Links[i];
try
{
int sourceWiId = _context.Journal.GetMigratedId(link.SourceOriginId);
@@ -684,6 +685,13 @@ private bool ApplyAndSaveLinks(WiRevision rev, WorkItem wi, Settings settings)
continue;
}

if (i > 0)
{
// If this has multiple link updates, defer each ubsequent link import by 2 miliseconds.
// Otherwise the Work Items API will send the response: "VS402625: Dates must be increasing with each revision"
saveLinkTimestamp = saveLinkTimestamp.AddMilliseconds(2);
}

if (link.Change == ReferenceChangeType.Added && !_witClientUtils.AddAndSaveLink(link, wi, settings, rev.Author, saveLinkTimestamp))
{
success = false;