Improve throttle
MODIFY
WalletWasabi/Services/WasabiSynchronizer.cs
WalletWasabi/Services/WasabiSynchronizer.cs
@@ -262,7 +262,7 @@ namespace WalletWasabi.Services
{
Logger.LogInfo<WasabiSynchronizer>($"Downloaded filters for blocks from {filters.First().BlockHeight} to {filters.Last().BlockHeight}.");
}
- _ = BitcoinStore.IndexStore.TryCommitToFileAsync(TimeSpan.FromSeconds(7), Cancel.Token);
+ _ = BitcoinStore.IndexStore.TryCommitToFileAsync(TimeSpan.FromSeconds(3), Cancel.Token);
}
else if (response.FiltersResponseState == FiltersResponseState.BestKnownHashNotFound)
{
@@ -272,7 +272,7 @@ namespace WalletWasabi.Services
Logger.LogInfo<WasabiSynchronizer>($"REORG Invalid Block: {reorgedFilter.BlockHash}");
ignoreRequestInterval = true;
- _ = BitcoinStore.IndexStore.TryCommitToFileAsync(TimeSpan.FromSeconds(7), Cancel.Token);
+ _ = BitcoinStore.IndexStore.TryCommitToFileAsync(TimeSpan.FromSeconds(3), Cancel.Token);
}
else if (response.FiltersResponseState == FiltersResponseState.NoNewFilter)
{
@@ -323,7 +323,6 @@ namespace WalletWasabi.Services
}
finally
{
- await BitcoinStore.IndexStore.TryCommitToFileAsync(TimeSpan.Zero, CancellationToken.None);
Interlocked.CompareExchange(ref _running, 3, 2); // If IsStopping, make it stopped.
}
});

MODIFY
WalletWasabi/Stores/IndexStore.cs
WalletWasabi/Stores/IndexStore.cs
@@ -149,7 +149,10 @@ namespace WalletWasabi.Stores
{
// Increment the throttle ID and remember the incremented value.
int incremented = Interlocked.Increment(ref _throttleId);
+ if (incremented < 21)
+ {
await Task.Delay(throttle, cancel);
+ }
// If the _throttleId is still the incremented value, then I am the latest CommitToFileAsync request.
// In this case I want to make the _throttledId 0 and go ahead and do the writeline.

Improve throttle