Skip to content

Commit

Permalink
Attempt alternate workaround for CI race
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutch committed Sep 26, 2024
1 parent 9c106a6 commit 3931eeb
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion Editor.Tests/Extensions/CommandServiceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,30 @@ public static void CheckAndExecute<T> (
LogTrace ("Session open");
RegisterTraceHandlers (session);
}
// If we have a session, but it hasn't started yet, wait for it to start.
// We previously only called session.GetComputedItems to wait for the completion
// to be updated, but on slow machines, e.g. on CI, this could cause completion
// to be dismissed (TryDismissSafelyAsync) before it was even shown.
if (session is IAsyncCompletionSessionOperations sessionOperations) {
if (!sessionOperations.IsStarted) {
if (EnableDebugTrace) {
LogTrace ("Session is not started");
}
// wait up to 2.5 seconds in 25ms intervals
for (int i = 0; i < 100; i++) {
if (sessionOperations.IsStarted) {
if (EnableDebugTrace) {
LogTrace ("Session started after {i * 25}ms");
}
break;
}
Thread.Sleep (25);
}
}
}

//ensure the computation is completed before we continue typing
session.GetComputedItems (CancellationToken.None);
LogTrace ("Session open");
}
} else{
LogTrace ("Session not open");
Expand Down

0 comments on commit 3931eeb

Please sign in to comment.