mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 20:07:21 +01:00
add try catch around each scan
This commit is contained in:
parent
ff2b679a8c
commit
7f97b20883
2 changed files with 22 additions and 6 deletions
|
|
@ -45,7 +45,7 @@ public class FileDbManager
|
||||||
return GetValidatedFileCache(matchingEntries.First());
|
return GetValidatedFileCache(matchingEntries.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileCache? ValidateFileCache(FileCacheEntity fileCacheEntity)
|
public FileCache? ValidateFileCacheEntity(FileCacheEntity fileCacheEntity)
|
||||||
{
|
{
|
||||||
return GetValidatedFileCache(fileCacheEntity);
|
return GetValidatedFileCache(fileCacheEntity);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -178,10 +178,18 @@ public class PeriodicFileScanner : IDisposable
|
||||||
{
|
{
|
||||||
Task[] tasks = chunk.Select(c => Task.Run(() =>
|
Task[] tasks = chunk.Select(c => Task.Run(() =>
|
||||||
{
|
{
|
||||||
var file = _fileDbManager.ValidateFileCache(c);
|
try
|
||||||
if (file != null)
|
|
||||||
{
|
{
|
||||||
scannedFiles[file.Filepath] = true;
|
var file = _fileDbManager.ValidateFileCacheEntity(c);
|
||||||
|
if (file != null)
|
||||||
|
{
|
||||||
|
scannedFiles[file.Filepath] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Warn("Failed validating " + c.Filepath);
|
||||||
|
Logger.Warn(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
Interlocked.Increment(ref currentFileProgress);
|
Interlocked.Increment(ref currentFileProgress);
|
||||||
|
|
@ -203,8 +211,16 @@ public class PeriodicFileScanner : IDisposable
|
||||||
{
|
{
|
||||||
Task[] tasks = chunk.Select(c => Task.Run(() =>
|
Task[] tasks = chunk.Select(c => Task.Run(() =>
|
||||||
{
|
{
|
||||||
var entry = _fileDbManager.CreateFileEntry(c.Key);
|
try
|
||||||
if (entry == null) _ = _fileDbManager.CreateCacheEntry(c.Key);
|
{
|
||||||
|
var entry = _fileDbManager.CreateFileEntry(c.Key);
|
||||||
|
if (entry == null) _ = _fileDbManager.CreateCacheEntry(c.Key);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Warn("Failed adding " + c.Key);
|
||||||
|
Logger.Warn(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
Interlocked.Increment(ref currentFileProgress);
|
Interlocked.Increment(ref currentFileProgress);
|
||||||
})).ToArray();
|
})).ToArray();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue