Skip to content

Commit

Permalink
⌛ When trying to attach to the IDE ActiveDocument, increase wait betw…
Browse files Browse the repository at this point in the history
…een retries

Fixes #41
  • Loading branch information
kzu committed May 17, 2021
1 parent 979a36b commit 26c2236
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SmallSharp/MonitorActiveDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override bool Execute()
if (BuildEngine4.GetRegisteredTaskObject(nameof(ActiveDocumentMonitor), RegisteredTaskObjectLifetime.AppDomain) is not ActiveDocumentMonitor monitor)
{
var maxAttempts = 5;
for (var i = 0; i < maxAttempts; i++)
for (var i = 1; i <= maxAttempts; i++)
{
if (WindowsInterop.GetServiceProvider() is IServiceProvider services)
{
Expand All @@ -53,7 +53,8 @@ public override bool Execute()
{
Debug.WriteLine(e);
}
Thread.Sleep(200);
// Increase the wait time to allow more time between retries
Thread.Sleep(200 * i);
}
}

Expand Down

0 comments on commit 26c2236

Please sign in to comment.