Skip to content

Commit

Permalink
chore: Keep ConfigureAwait in macro if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Dec 27, 2023
1 parent 40597dd commit ed07855
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Testcontainers/Clients/TestcontainersClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,11 @@ public async Task<byte[]> ReadFileAsync(string id, string filePath, Cancellation

#if NETSTANDARD2_0
_ = await tarInputStream.ReadAsync(readBytes, 0, readBytes.Length, ct)
.ConfigureAwait(false);
#else
_ = await tarInputStream.ReadAsync(readBytes, ct)
#endif
.ConfigureAwait(false);
#endif

return readBytes;
}
Expand Down
9 changes: 6 additions & 3 deletions src/Testcontainers/Containers/ResourceReaper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ await tcpClient.ConnectAsync(host, port)
{
#if NETSTANDARD2_0
await stream.WriteAsync(sendBytes, 0, sendBytes.Length, ct)
.ConfigureAwait(false);
#else
await stream.WriteAsync(sendBytes, ct)
#endif
.ConfigureAwait(false);
#endif

await stream.FlushAsync(ct)
.ConfigureAwait(false);
Expand All @@ -322,10 +323,11 @@ await stream.FlushAsync(ct)
{
#if NETSTANDARD2_0
var numberOfBytes = await stream.ReadAsync(readBytes, 0, readBytes.Length, ct)
.ConfigureAwait(false);
#else
var numberOfBytes = await stream.ReadAsync(readBytes, ct)
#endif
.ConfigureAwait(false);
#endif

if (numberOfBytes == 0)
{
Expand Down Expand Up @@ -367,10 +369,11 @@ await Task.Delay(TimeSpan.FromSeconds(RetryTimeoutInSeconds), ct)
// Keep the connection to Ryuk up.
#if NETSTANDARD2_0
_ = await stream.ReadAsync(readBytes, 0, readBytes.Length, _maintainConnectionCts.Token)
.ConfigureAwait(false);
#else
_ = await stream.ReadAsync(readBytes, _maintainConnectionCts.Token)
#endif
.ConfigureAwait(false);
#endif
}
}
catch (OperationCanceledException)
Expand Down
3 changes: 2 additions & 1 deletion src/Testcontainers/Containers/TarOutputMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ await PutNextEntryAsync(tarEntry, ct)

#if NETSTANDARD2_0
await WriteAsync(fileContent, 0, fileContent.Length, ct)
.ConfigureAwait(false);
#else
await WriteAsync(fileContent, ct)
#endif
.ConfigureAwait(false);
#endif

await CloseEntryAsync(ct)
.ConfigureAwait(false);
Expand Down

0 comments on commit ed07855

Please sign in to comment.