Make cts the last parameter by convention in the library project
MODIFY
WalletWasabi.Tests/UnitTests/AsyncMutexTests.cs
WalletWasabi.Tests/UnitTests/AsyncMutexTests.cs
@@ -39,7 +39,7 @@ namespace WalletWasabi.Tests.UnitTests
{
await Assert.ThrowsAsync<IOException>(async () =>
{
- using (await asyncMutex2.LockAsync(cts.Token))
+ using (await asyncMutex2.LockAsync(cancellationToken: cts.Token))
{
throw new InvalidOperationException("Mutex should not be acquired here.");
};
@@ -138,7 +138,7 @@ namespace WalletWasabi.Tests.UnitTests
using var cts = new CancellationTokenSource(100);
await Assert.ThrowsAsync<IOException>(async () =>
{
- using (await mutex.LockAsync(cts.Token))
+ using (await mutex.LockAsync(cancellationToken: cts.Token))
{
}
});
@@ -152,7 +152,7 @@ namespace WalletWasabi.Tests.UnitTests
var mutex2 = new AsyncMutex(mutexName2);
await Assert.ThrowsAsync<IOException>(async () =>
{
- using (await mutex2.LockAsync(cts.Token))
+ using (await mutex2.LockAsync(cancellationToken: cts.Token))
{
}
});

MODIFY
WalletWasabi/Blockchain/Transactions/AllTransactionStore.cs
WalletWasabi/Blockchain/Transactions/AllTransactionStore.cs
@@ -35,7 +35,7 @@ namespace WalletWasabi.Blockchain.Transactions
public TransactionStore ConfirmedStore { get; }
private object Lock { get; } = new object();
- public async Task InitializeAsync(CancellationToken cancel = default, bool ensureBackwardsCompatibility = true)
+ public async Task InitializeAsync(bool ensureBackwardsCompatibility = true, CancellationToken cancel = default)
{
using (BenchmarkLogger.Measure())
{

MODIFY
WalletWasabi/Nito/AsyncEx/AsyncMutex.cs
WalletWasabi/Nito/AsyncEx/AsyncMutex.cs
@@ -212,7 +212,7 @@ namespace Nito.AsyncEx
/// <summary>
/// Standard procedure to send command to the mutex thread.
/// </summary>
- private async Task SetCommandAsync(int command, CancellationToken cancellationToken, int pollInterval)
+ private async Task SetCommandAsync(int command, int pollInterval, CancellationToken cancellationToken)
{
if (!IsAlive)
{
@@ -270,7 +270,7 @@ namespace Nito.AsyncEx
/// </summary>
/// <param name="pollInterval">The frequency of polling the termination of the mutex-thread.</param>
/// <returns>The IDisposable await-able Task.</returns>
- public async Task<IDisposable> LockAsync(CancellationToken cancellationToken = default, int pollInterval = 100)
+ public async Task<IDisposable> LockAsync(int pollInterval = 100, CancellationToken cancellationToken = default)
{
Exception inner = null;
@@ -300,7 +300,7 @@ namespace Nito.AsyncEx
try
{
// Create the mutex and acquire it.
- await SetCommandAsync(1, cancellationToken, pollInterval).ConfigureAwait(false);
+ await SetCommandAsync(1, pollInterval, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{

MODIFY
WalletWasabi/Services/SingleInstanceChecker.cs
WalletWasabi/Services/SingleInstanceChecker.cs
@@ -51,7 +51,7 @@ namespace WalletWasabi.Services
try
{
using CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(200));
- SingleApplicationLockHolder = await mutex.LockAsync(cts.Token).ConfigureAwait(false);
+ SingleApplicationLockHolder = await mutex.LockAsync(cancellationToken: cts.Token).ConfigureAwait(false);
}
catch (IOException ex)
{

MODIFY
WalletWasabi/Stores/BitcoinStore.cs
WalletWasabi/Stores/BitcoinStore.cs
@@ -50,7 +50,7 @@ namespace WalletWasabi.Stores
var initTasks = new[]
{
IndexStore.InitializeAsync(cancel),
- TransactionStore.InitializeAsync(cancel)
+ TransactionStore.InitializeAsync(cancel: cancel)
};
await Task.WhenAll(initTasks).ConfigureAwait(false);

Make cts the last parameter by convention in the library project