mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Revert Subfolder Optimization (#3646)
This commit is contained in:
parent
e93cab240e
commit
fb8bbcfa13
@ -358,7 +358,8 @@ public class ParseScannedFilesTests : AbstractDbTest
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[Fact]
|
// TODO: Add back in (removed for Hotfix v0.8.5.x)
|
||||||
|
//[Fact]
|
||||||
public async Task HasSeriesFolderNotChangedSinceLastScan_AllSeriesFoldersHaveChanges()
|
public async Task HasSeriesFolderNotChangedSinceLastScan_AllSeriesFoldersHaveChanges()
|
||||||
{
|
{
|
||||||
const string testcase = "Subfolders always scanning all series changes - Manga.json";
|
const string testcase = "Subfolders always scanning all series changes - Manga.json";
|
||||||
@ -452,7 +453,8 @@ public class ParseScannedFilesTests : AbstractDbTest
|
|||||||
Assert.Equal(1, changes);
|
Assert.Equal(1, changes);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
// TODO: Add back in (removed for Hotfix v0.8.5.x)
|
||||||
|
//[Fact]
|
||||||
public async Task SubFoldersNoSubFolders_SkipAll()
|
public async Task SubFoldersNoSubFolders_SkipAll()
|
||||||
{
|
{
|
||||||
const string testcase = "Subfolders and files at root - Manga.json";
|
const string testcase = "Subfolders and files at root - Manga.json";
|
||||||
|
@ -209,17 +209,27 @@ public class ParseScannedFiles
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private bool HasSeriesFolderNotChangedSinceLastScan(Library library, IDictionary<string, IList<SeriesModified>> seriesPaths, string directory, bool forceCheck)
|
private bool HasSeriesFolderNotChangedSinceLastScan(Library library, IDictionary<string, IList<SeriesModified>> seriesPaths, string directory, bool forceCheck)
|
||||||
{
|
{
|
||||||
if (forceCheck)
|
// Reverting code from: https://github.com/Kareadita/Kavita/pull/3619/files#diff-0625df477047ab9d8e97a900201f2f29b2dc0599ba58eb75cfbbd073a9f3c72f
|
||||||
|
// This is to be able to release hotfix and tackle this in appropriate time
|
||||||
|
|
||||||
|
// With the bottom-up approach, this can report a false positive where a nested folder will get scanned even though a parent is the series
|
||||||
|
// This can't really be avoided. This is more likely to happen on Image chapter folder library layouts.
|
||||||
|
if (forceCheck || !seriesPaths.TryGetValue(directory, out var seriesList))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (forceCheck)
|
||||||
|
// {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
// TryGetSeriesList falls back to parent folders to match to seriesList
|
// TryGetSeriesList falls back to parent folders to match to seriesList
|
||||||
var seriesList = TryGetSeriesList(library, seriesPaths, directory);
|
// var seriesList = TryGetSeriesList(library, seriesPaths, directory);
|
||||||
if (seriesList == null)
|
// if (seriesList == null)
|
||||||
{
|
// {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
foreach (var series in seriesList)
|
foreach (var series in seriesList)
|
||||||
{
|
{
|
||||||
@ -299,7 +309,9 @@ public class ParseScannedFiles
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result.Add(CreateScanResult(directory, folderPath, hasChanged, files));
|
// Revert of https://github.com/Kareadita/Kavita/pull/3629/files#diff-0625df477047ab9d8e97a900201f2f29b2dc0599ba58eb75cfbbd073a9f3c72f
|
||||||
|
// for Hotfix v0.8.5.x
|
||||||
|
result.Add(CreateScanResult(directory, folderPath, true, files));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -758,11 +770,15 @@ public class ParseScannedFiles
|
|||||||
// If folder hasn't changed, generate fake ParserInfos
|
// If folder hasn't changed, generate fake ParserInfos
|
||||||
if (!result.HasChanged)
|
if (!result.HasChanged)
|
||||||
{
|
{
|
||||||
// We are certain TryGetSeriesList will return a valid result here, if the series wasn't present yet. It will have been changed.
|
result.ParserInfos = seriesPaths[normalizedFolder]
|
||||||
result.ParserInfos = TryGetSeriesList(library, seriesPaths, normalizedFolder)!
|
|
||||||
.Select(fp => new ParserInfo { Series = fp.SeriesName, Format = fp.Format })
|
.Select(fp => new ParserInfo { Series = fp.SeriesName, Format = fp.Format })
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
// // We are certain TryGetSeriesList will return a valid result here, if the series wasn't present yet. It will have been changed.
|
||||||
|
// result.ParserInfos = TryGetSeriesList(library, seriesPaths, normalizedFolder)!
|
||||||
|
// .Select(fp => new ParserInfo { Series = fp.SeriesName, Format = fp.Format })
|
||||||
|
// .ToList();
|
||||||
|
|
||||||
_logger.LogDebug("[ScannerService] Skipped File Scan for {Folder} as it hasn't changed", normalizedFolder);
|
_logger.LogDebug("[ScannerService] Skipped File Scan for {Folder} as it hasn't changed", normalizedFolder);
|
||||||
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
|
await _eventHub.SendMessageAsync(MessageFactory.NotificationProgress,
|
||||||
MessageFactory.FileScanProgressEvent($"Skipped {normalizedFolder}", library.Name, ProgressEventType.Updated));
|
MessageFactory.FileScanProgressEvent($"Skipped {normalizedFolder}", library.Name, ProgressEventType.Updated));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user