Misc Polish (#1569)
* Introduced a lock for DB work during the scan to hopefully reduce the concurrency issues * Don't allow multiple theme scans to occur * Fixed bulk actions not having all actions due to nested actionable menu changes * Refactored the Scan loop to be synchronous to avoid any issues. After first loop, no real performance issues. * Updated the LibraryWatcher when under many internal buffer full issues, to suspend watching for a full hour, to allow whatever downloading to complete. * Removed Semaphore as it's not needed anymore * Updated the output for logger to explicitly say from Kavita (if you're pushing to Seq) * Fixed a broken test * Fixed ReleaseYear not populating due to a change from a contributor around how to populate ReleaseYear. * Ensure when scan folder runs, that we don't double enqueue the same tasks. * Fixed user settings not loading the correct tab * Changed the Release Year -> Release * Added more refresh hooks in reader to hopefully ensure faster refreshes * Reset images between chapter loads to help flush image faster. Don't show broken image icon when an image is still loading. * Fixed the prefetcher not properly loading the correct images and hence, allowing a bit of lag between chapter loads. * Code smells
This commit is contained in:
parent
097ec32842
commit
58bbba29cc
17 changed files with 208 additions and 45 deletions
|
|
@ -102,6 +102,12 @@ public class ScannerService : IScannerService
|
|||
var seriesId = await _unitOfWork.SeriesRepository.GetSeriesIdByFolder(folder);
|
||||
if (seriesId > 0)
|
||||
{
|
||||
if (TaskScheduler.HasAlreadyEnqueuedTask(Name, "ScanSeries",
|
||||
new object[] {seriesId, true}))
|
||||
{
|
||||
_logger.LogInformation("[ScannerService] Scan folder invoked for {Folder} but a task is already queued for this series. Dropping request", folder);
|
||||
return;
|
||||
}
|
||||
BackgroundJob.Enqueue(() => ScanSeries(seriesId, true));
|
||||
return;
|
||||
}
|
||||
|
|
@ -119,6 +125,12 @@ public class ScannerService : IScannerService
|
|||
var library = libraries.FirstOrDefault(l => l.Folders.Select(Scanner.Parser.Parser.NormalizePath).Contains(libraryFolder));
|
||||
if (library != null)
|
||||
{
|
||||
if (TaskScheduler.HasAlreadyEnqueuedTask(Name, "ScanLibrary",
|
||||
new object[] {library.Id, false}))
|
||||
{
|
||||
_logger.LogInformation("[ScannerService] Scan folder invoked for {Folder} but a task is already queued for this library. Dropping request", folder);
|
||||
return;
|
||||
}
|
||||
BackgroundJob.Enqueue(() => ScanLibrary(library.Id, false));
|
||||
}
|
||||
}
|
||||
|
|
@ -175,13 +187,11 @@ public class ScannerService : IScannerService
|
|||
}
|
||||
|
||||
var parsedSeries = new Dictionary<ParsedSeries, IList<ParserInfo>>();
|
||||
var processTasks = new List<Task>();
|
||||
|
||||
|
||||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress, MessageFactory.LibraryScanProgressEvent(library.Name, ProgressEventType.Started, series.Name));
|
||||
|
||||
await _processSeries.Prime();
|
||||
void TrackFiles(Tuple<bool, IList<ParserInfo>> parsedInfo)
|
||||
async Task TrackFiles(Tuple<bool, IList<ParserInfo>> parsedInfo)
|
||||
{
|
||||
var parsedFiles = parsedInfo.Item2;
|
||||
if (parsedFiles.Count == 0) return;
|
||||
|
|
@ -198,7 +208,7 @@ public class ScannerService : IScannerService
|
|||
return;
|
||||
}
|
||||
|
||||
processTasks.Add(_processSeries.ProcessSeriesAsync(parsedFiles, library));
|
||||
await _processSeries.ProcessSeriesAsync(parsedFiles, library);
|
||||
parsedSeries.Add(foundParsedSeries, parsedFiles);
|
||||
}
|
||||
|
||||
|
|
@ -424,7 +434,7 @@ public class ScannerService : IScannerService
|
|||
|
||||
await _processSeries.Prime();
|
||||
var processTasks = new List<Task>();
|
||||
void TrackFiles(Tuple<bool, IList<ParserInfo>> parsedInfo)
|
||||
async Task TrackFiles(Tuple<bool, IList<ParserInfo>> parsedInfo)
|
||||
{
|
||||
var skippedScan = parsedInfo.Item1;
|
||||
var parsedFiles = parsedInfo.Item2;
|
||||
|
|
@ -452,7 +462,7 @@ public class ScannerService : IScannerService
|
|||
|
||||
|
||||
seenSeries.Add(foundParsedSeries);
|
||||
processTasks.Add(_processSeries.ProcessSeriesAsync(parsedFiles, library));
|
||||
await _processSeries.ProcessSeriesAsync(parsedFiles, library);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -512,7 +522,7 @@ public class ScannerService : IScannerService
|
|||
}
|
||||
|
||||
private async Task<long> ScanFiles(Library library, IEnumerable<string> dirs,
|
||||
bool isLibraryScan, Action<Tuple<bool, IList<ParserInfo>>> processSeriesInfos = null, bool forceChecks = false)
|
||||
bool isLibraryScan, Func<Tuple<bool, IList<ParserInfo>>, Task> processSeriesInfos = null, bool forceChecks = false)
|
||||
{
|
||||
var scanner = new ParseScannedFiles(_logger, _directoryService, _readingItemService, _eventHub);
|
||||
var scanWatch = Stopwatch.StartNew();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue