From 891a83bd0e143a594d7780703c44efc83d8ef6b3 Mon Sep 17 00:00:00 2001 From: bezzad Date: Tue, 19 Dec 2023 11:39:36 +0330 Subject: [PATCH] removed reference varible to watcher task and prevent diposing matter --- README.md | 8 +++++++- src/Downloader/ConcurrentStream.cs | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 10054f8..a6c72e3 100644 --- a/README.md +++ b/README.md @@ -374,8 +374,14 @@ We accept pull requests from the community. But, you should **never** work on a ## You can run tests with Docker Compose file with the following command: > `docker-compose -p downloader up` -# License +## Or with docker file: +> `docker build -f ./dockerfile -t downloader-linux .` +> `docker run --name downloader-linux-container -d downloader-linux --env=ASPNETCORE_ENVIRONMENT=Development .` + +## Or run the following command to call docker directly: +> `docker run --rm -v ${pwd}:/app --env=ASPNETCORE_ENVIRONMENT=Development -w /app/tests mcr.microsoft.com/dotnet/sdk:6.0 dotnet test ../ --logger:trx` +# License Licensed under the terms of the [MIT License](https://raw.githubusercontent.com/bezzad/Downloader/master/LICENSE) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fbezzad%2FDownloader.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fbezzad%2FDownloader?ref=badge_large) diff --git a/src/Downloader/ConcurrentStream.cs b/src/Downloader/ConcurrentStream.cs index e2fa3f7..8eabcd9 100644 --- a/src/Downloader/ConcurrentStream.cs +++ b/src/Downloader/ConcurrentStream.cs @@ -12,7 +12,6 @@ public class ConcurrentStream : TaskStateManagement, IDisposable private volatile bool _disposed; private Stream _stream; private string _path; - private Task _watcher; private CancellationTokenSource _watcherCancelSource; public string Path @@ -104,7 +103,7 @@ private void Initial(long maxMemoryBufferBytes, ILogger logger = null) creationOptions: TaskCreationOptions.LongRunning, scheduler: TaskScheduler.Default); - _watcher = task.Unwrap(); + task.Unwrap(); } public Stream OpenRead()