Riduzione problema memoria che "deriva" su check dati

This commit is contained in:
Samuele Locatelli
2022-12-29 16:46:23 +01:00
parent 8be3041eff
commit 7f9afdf5fb
4 changed files with 67 additions and 59 deletions
+12 -17
View File
@@ -157,6 +157,7 @@ namespace MP.FileData.Controllers
fileNew = new List<FileInfo>();
fileChecked = new List<FileModel>();
fileMod = new List<FileModel>();
GC.Collect();
// chiudo
return checkDone;
}
@@ -503,24 +504,16 @@ namespace MP.FileData.Controllers
if (forceTag)
{
// elenco Tags
List<TagModel> currTags = localDbCtx.DbSetTags.ToList();
List <TagModel> currTags = localDbCtx.DbSetTags.ToList();
FileModel currItem = null;
foreach (var item in updFiles)
{
// recupero record da DB...
var currItem = localDbCtx
.DbSetProgFile
.Where(x => x.FileId == item.FileId)
.Include(x => x.Tags)
.FirstOrDefault();
#if false
// rimuovo tags vecchi
if (currItem.Tags != null)
{
currItem.Tags.Clear();
//localDbCtx.Entry(item).State = EntityState.Modified;
//localDbCtx.SaveChanges();
}
#endif
currItem = localDbCtx
.DbSetProgFile
.Where(x => x.FileId == item.FileId)
.Include(x => x.Tags)
.FirstOrDefault();
List<string> Tags = new List<string>();
List<TagModel> Tag4File = new List<TagModel>();
@@ -583,17 +576,19 @@ namespace MP.FileData.Controllers
Log.Error($"Errore in salvataggio FileSetChecked{Environment.NewLine}{exc}");
}
}
#if false
// update comunque data-ora
foreach (var item in updFiles)
{
// salvo update file
item.LastCheck = adesso;
localDbCtx.Entry(item).State = EntityState.Modified;
}
}
#endif
answ = true;
}
GC.Collect();
return answ;
}