Pointing out the bug with the scan task

This commit is contained in:
Zoe Roux 2020-02-11 00:11:53 +01:00
parent 82add5cd50
commit 5eed35d4ac
2 changed files with 3 additions and 1 deletions

View File

@ -10,6 +10,8 @@ namespace Kyoo.Controllers
[HttpGet("scan")] [HttpGet("scan")]
public IActionResult ScanLibrary([FromServices] ICrawler crawler) 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()); crawler.StartAsync(new CancellationToken());
return Ok("Scanning"); return Ok("Scanning");
} }

View File

@ -41,10 +41,10 @@ namespace Kyoo
// services.AddIdentityServer(); // services.AddIdentityServer();
services.AddScoped<ILibraryManager, LibraryManager>(); services.AddScoped<ILibraryManager, LibraryManager>();
services.AddScoped<ICrawler, Crawler>();
services.AddSingleton<ITranscoder, Transcoder>(); services.AddSingleton<ITranscoder, Transcoder>();
services.AddSingleton<IThumbnailsManager, ThumbnailsManager>(); services.AddSingleton<IThumbnailsManager, ThumbnailsManager>();
services.AddSingleton<IProviderManager, ProviderManager>(); services.AddSingleton<IProviderManager, ProviderManager>();
services.AddScoped<ICrawler, Crawler>();
services.AddSingleton<IPluginManager, PluginManager>(); services.AddSingleton<IPluginManager, PluginManager>();
services.AddHostedService<StartupCode>(); services.AddHostedService<StartupCode>();