Skip to content

Commit

Permalink
Merge pull request WalletWasabi#12311 from Szpoti/fixCatchInSynchronizer
Browse files Browse the repository at this point in the history
Refactor exception catches in `WasabiSynchronizer`
  • Loading branch information
molnard authored Jan 29, 2024
2 parents 7cdbda3 + 085706c commit c5771c9
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions WalletWasabi/Services/WasabiSynchronizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,36 +181,11 @@ protected override async Task ActionAsync(CancellationToken cancel)
AllFeeEstimateArrived?.Invoke(this, allFeeEstimate);
}
}
catch (OperationCanceledException)
catch (HttpRequestException)
{
Logger.LogInfo("Wasabi Synchronizer execution was canceled.");
}
catch (HttpRequestException ex) when (ex.InnerException is TorConnectionException)
{
// When stopping, we do not want to wait.
if (cancel.IsCancellationRequested)
{
Logger.LogTrace(ex);
return;
}

Logger.LogError(ex);
try
{
await Task.Delay(3000, cancel).ConfigureAwait(false); // Give other threads time to do stuff.
}
catch (TaskCanceledException ex2)
{
Logger.LogTrace(ex2);
}
}
catch (TimeoutException ex)
{
Logger.LogTrace(ex);
}
catch (Exception ex)
{
Logger.LogError(ex);
await Task.Delay(3000, cancel).ConfigureAwait(false); // Retry sooner in case of connection error.
TriggerRound();
throw;
}
}

Expand Down

0 comments on commit c5771c9

Please sign in to comment.