mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-28 19:54:48 +03:00
IAsyncDisposable is one big pitfall
https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync#unacceptable-pattern Regex used: ``` await using \(.+\) \W+await using ```
This commit is contained in:
@@ -545,12 +545,14 @@ namespace Jellyfin.Server
|
||||
const string ResourcePath = "Jellyfin.Server.Resources.Configuration.logging.json";
|
||||
Stream resource = typeof(Program).Assembly.GetManifestResourceStream(ResourcePath)
|
||||
?? throw new InvalidOperationException($"Invalid resource path: '{ResourcePath}'");
|
||||
Stream dst = new FileStream(configPath, FileMode.CreateNew, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
|
||||
await using (resource.ConfigureAwait(false))
|
||||
await using (dst.ConfigureAwait(false))
|
||||
{
|
||||
// Copy the resource contents to the expected file path for the config file
|
||||
await resource.CopyToAsync(dst).ConfigureAwait(false);
|
||||
Stream dst = new FileStream(configPath, FileMode.CreateNew, FileAccess.Write, FileShare.None, IODefaults.FileStreamBufferSize, FileOptions.Asynchronous);
|
||||
await using (dst.ConfigureAwait(false))
|
||||
{
|
||||
// Copy the resource contents to the expected file path for the config file
|
||||
await resource.CopyToAsync(dst).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user