Closed sburmanoctopus closed 1 year ago
This pull request has been linked to Shortcut Story #53211: π π π Make Halibut Support Async RPC Calls π π π.
[sc-57124]
This pull request has been linked to Shortcut Story #53211: π π π Make Halibut Support Async RPC Calls π π π.
[sc-57123]
This pull request has been linked to Shortcut Story #57123: RewindableBufferStream needs an async Dispose method (and that to be tested).
[sc-53211]
Background
Continuing on from making disposing async, we need to make disposal with
using
statements become async.Results
Related to https://github.com/OctopusDeploy/Issues/issues/8266
Before
Whenever something that supports async operations is disposed, it does the disposal synchronously on the thread. This blocks the thread if disposal involves things like IO.
After
We now try to use
await using
instead ofusing
do that any asynchronous operations done during disposal will no longer block the calling thread..NET 4.8 Complications
Streams in .NET 4.8 do not support
IAsyncDisposable
. This means we cannot addawait
tousing
statements.This was fixed by wrapping the
await
in a#if
RewindableBufferStream
We also made
RewindableBufferStream
implementIAsyncDisposable
. This allowed us to usingawait using
whenever we interacted with this type of stream.Using Our Streams
We made all our streams extend
IAsyncDisposable
so that they would work in .NET 4.8 withawait using
How to review this PR
Quality :heavy_check_mark:
Pre-requisites