diff --git a/MP.FileData/Controllers/FileController.cs b/MP.FileData/Controllers/FileController.cs index 844c0372..4001ab68 100644 --- a/MP.FileData/Controllers/FileController.cs +++ b/MP.FileData/Controllers/FileController.cs @@ -157,6 +157,7 @@ namespace MP.FileData.Controllers fileNew = new List(); fileChecked = new List(); fileMod = new List(); + GC.Collect(); // chiudo return checkDone; } @@ -503,24 +504,16 @@ namespace MP.FileData.Controllers if (forceTag) { // elenco Tags - List currTags = localDbCtx.DbSetTags.ToList(); + List 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 Tags = new List(); List Tag4File = new List(); @@ -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; } diff --git a/MP.Prog/Components/ArchiveStatus.razor.cs b/MP.Prog/Components/ArchiveStatus.razor.cs index 8548a55f..9c53d2f0 100644 --- a/MP.Prog/Components/ArchiveStatus.razor.cs +++ b/MP.Prog/Components/ArchiveStatus.razor.cs @@ -8,23 +8,17 @@ using System.Threading.Tasks; namespace MP.Prog.Components { - public partial class ArchiveStatus + public partial class ArchiveStatus : IDisposable { - #region Private Fields + #region Public Methods - private List ListRecords; + public void Dispose() + { + // Clear database context + GC.Collect(); + } - private int numChecks = 0; - - private int totalCount = 0; - - #endregion Private Fields - - #region Private Properties - - private List setupMessages { get; set; } = new List(); - - #endregion Private Properties + #endregion Public Methods #region Protected Properties @@ -36,32 +30,6 @@ namespace MP.Prog.Components #endregion Protected Properties - #region Private Methods - - private async Task verificaSingola(string idxMacchina, int numDays, int numMacchine) - { - // recupero elenco macchine - percLoading += 100 / numMacchine; - numChecks = await DataService.updateMachineArchive(idxMacchina, numDays, true, false); - await Task.Delay(1); - setupMessages.Add($"{idxMacchina}: {numChecks} files"); - StateHasChanged(); - await Task.Delay(1); - } - - private async Task verificaTutte(int numDays) - { - // recupero elenco macchine - var listaMacchine = await DataService.MacchineGetAll(); - int numMacchine = listaMacchine.Count(); - foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList()) - { - await verificaSingola(item.IdxMacchina, numDays, numMacchine); - } - } - - #endregion Private Methods - #region Protected Methods protected async Task ArchiveCheck(int maxHour) @@ -129,5 +97,47 @@ namespace MP.Prog.Components } #endregion Protected Methods + + #region Private Fields + + private List ListRecords; + + private int numChecks = 0; + + private int totalCount = 0; + + #endregion Private Fields + + #region Private Properties + + private List setupMessages { get; set; } = new List(); + + #endregion Private Properties + + #region Private Methods + + private async Task verificaSingola(string idxMacchina, int numDays, int numMacchine) + { + // recupero elenco macchine + percLoading += 100 / numMacchine; + numChecks = await DataService.updateMachineArchive(idxMacchina, numDays, true, false); + await Task.Delay(1); + setupMessages.Add($"{idxMacchina}: {numChecks} files"); + await InvokeAsync(StateHasChanged); + await Task.Delay(1); + } + + private async Task verificaTutte(int numDays) + { + // recupero elenco macchine + var listaMacchine = await DataService.MacchineGetAll(); + int numMacchine = listaMacchine.Count(); + foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList()) + { + await verificaSingola(item.IdxMacchina, numDays, numMacchine); + } + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Prog/Conf/Rule04.json b/MP.Prog/Conf/Rule04.json index 565d7c90..7133d616 100644 --- a/MP.Prog/Conf/Rule04.json +++ b/MP.Prog/Conf/Rule04.json @@ -25,6 +25,10 @@ "CNCTYPE", "VENDOR", "MODEL", - "MPIP" + "MPIP", + "Customer", + "HostOS", + "HostName", + "HostAddr" ] } \ No newline at end of file diff --git a/MP.Prog/Pages/Setup.razor b/MP.Prog/Pages/Setup.razor index f13a03f9..6ae5a7a0 100644 --- a/MP.Prog/Pages/Setup.razor +++ b/MP.Prog/Pages/Setup.razor @@ -13,5 +13,4 @@
- @**@ \ No newline at end of file