mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-16 10:29:01 -07:00
better stream disposal
This commit is contained in:
parent
6a5d6b5d4c
commit
887c280a1b
@ -427,17 +427,16 @@ namespace MediaBrowser.Server.Implementations.Providers
|
||||
//Tell the watchers to ignore
|
||||
_directoryWatchers.TemporarilyIgnore(path);
|
||||
|
||||
//Make the mod
|
||||
|
||||
dataToSave.Position = 0;
|
||||
|
||||
try
|
||||
{
|
||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
|
||||
{
|
||||
await dataToSave.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
dataToSave.Dispose();
|
||||
using (var input = dataToSave)
|
||||
{
|
||||
await input.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// If this is ever used for something other than metadata we can add a file type param
|
||||
item.ResolveArgs.AddMetadataFile(path);
|
||||
|
Loading…
Reference in New Issue
Block a user