From 5eed35d4ac4d1f5020e40517f211c406b0bb5833 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Tue, 11 Feb 2020 00:11:53 +0100 Subject: [PATCH] Pointing out the bug with the scan task --- Kyoo/HtmlAPI/AdminAPI.cs | 2 ++ Kyoo/Startup.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Kyoo/HtmlAPI/AdminAPI.cs b/Kyoo/HtmlAPI/AdminAPI.cs index 8f861e89..22c23900 100644 --- a/Kyoo/HtmlAPI/AdminAPI.cs +++ b/Kyoo/HtmlAPI/AdminAPI.cs @@ -10,6 +10,8 @@ namespace Kyoo.Controllers [HttpGet("scan")] public IActionResult ScanLibrary([FromServices] ICrawler crawler) { + // The crawler is destroyed before the completion of this task. + // TODO implement an hosted service that can queue tasks from the controller. crawler.StartAsync(new CancellationToken()); return Ok("Scanning"); } diff --git a/Kyoo/Startup.cs b/Kyoo/Startup.cs index a7cc97ed..078ea5f8 100644 --- a/Kyoo/Startup.cs +++ b/Kyoo/Startup.cs @@ -41,10 +41,10 @@ namespace Kyoo // services.AddIdentityServer(); services.AddScoped(); + services.AddScoped(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddScoped(); services.AddSingleton(); services.AddHostedService();