New and moved files Upsert themselves in FileManager.FilePathCache
This commit is contained in:
parent
18cca53968
commit
d0b78cc501
11 changed files with 149 additions and 144 deletions
|
|
@ -56,9 +56,15 @@ namespace FileManager
|
|||
}
|
||||
|
||||
public static void Upsert(string id, FileType type, string path)
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
throw new FileNotFoundException("Cannot add path to cache. File not found");
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
// file not found can happen after rapid move
|
||||
System.Threading.Thread.Sleep(100);
|
||||
|
||||
if (!File.Exists(path))
|
||||
throw new FileNotFoundException($"Cannot add path to cache. File not found. Id={id} FileType={type}", path);
|
||||
}
|
||||
|
||||
var entry = cache.SingleOrDefault(i => i.Id == id && i.FileType == type);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue