From 9037789ad6d2c2e6bfa4e7b04228e04b73a31f2c Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 9 Dec 2020 15:32:32 +0100 Subject: [PATCH] start new rel x autorestart fixed --- IOB-MAN/IOBManPanel.cs | 28 +++++++++++++++++++++++----- Jenkinsfile | 2 +- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index 1e4ae770..8b55971b 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -583,6 +583,7 @@ namespace IOB_MAN /// Chiude item richiesto private void closeSingleChild(iobAdapt item) { + utils.lgInfo($"Chiusura processo | IOB: {item.CodIOB} | pid: {item.pID}"); // rimuovo item ElencoIOB.Remove(item); try @@ -982,16 +983,18 @@ namespace IOB_MAN int indice = 0; foreach (iobAdapt item in ElencoIOB.List) { - // se NON comunica da troppo (ultima comunicazione è > 5 minuti fa...) - if (!item.plcOk) - { - proc2close.Add(indice, item); - } // se NON E' running if (!item.isRunning) { // segno da eliminare e riavviare proc2restart.Add(indice, item); + utils.lgInfo($"Processo non in running | IOB: {item.CodIOB} | pid: {item.pID}"); + } + // se NON comunica da troppo (ultima comunicazione è > 5 minuti fa...) + else if (!item.plcOk) + { + proc2close.Add(indice, item); + utils.lgInfo($"Processo non in PLC-Online | IOB: {item.CodIOB} | pid: {item.pID}"); } indice++; } @@ -999,6 +1002,20 @@ namespace IOB_MAN // SE abilitato autorestart... if (chkAutoRestart.Checked) { + var allProcess = proc2close.Concat(proc2restart).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value); + foreach (var item in allProcess) + { + ElencoIOB.Remove(item); + // chiudo! + closeSingleChild(item.Value); + } + foreach (var item in allProcess) + { + // riavvio! + startChildProc(item.Value.CodIOB, item.Key); + } + +#if false // in primis processo quelli che non comunicano e mi limito a chiuderli... foreach (var item in proc2close) { @@ -1024,6 +1041,7 @@ namespace IOB_MAN { startChildProc(item.Value.CodIOB, item.Key); } +#endif // update! updateStatus(); diff --git a/Jenkinsfile b/Jenkinsfile index a010cd62..af5ff313 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=758']) { + withEnv(['NEXT_BUILD_NUMBER=759']) { // env.versionNumber = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'