From 15d4cc2af5cbf66732c67907fd73240f5204566b Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 21 Oct 2020 18:19:04 +0200 Subject: [PATCH] calmierata riduzione status attivo --- IOB-WIN/IobFileEurom63.cs | 47 ++++++++++++++++++++++++++++++--------- Jenkinsfile | 2 +- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/IOB-WIN/IobFileEurom63.cs b/IOB-WIN/IobFileEurom63.cs index a714feb8..3477511c 100644 --- a/IOB-WIN/IobFileEurom63.cs +++ b/IOB-WIN/IobFileEurom63.cs @@ -17,6 +17,8 @@ namespace IOB_WIN { #region Protected Fields + protected static DateTime lastStatusDecr = DateTime.Now; + /// /// step di comunicazione attivo /// @@ -87,18 +89,24 @@ namespace IOB_WIN private void checkSessionActive(Eurom63.Session currSession, Eurom63.ComLevel nextLevel) { // SOLO SE ha senso che controllo (sono in sampling...) - if (actLevel > Eurom63.ComLevel.ChannelOk) + if (actLevel > Eurom63.ComLevel.HasInfo) { DateTime adesso = DateTime.Now; // devono essere ATTIVE le sessioni di campionamento... e NON scadute if (!currSession.Active || currSession.SessionValidUntil < adesso) { - // elimino TUTTE le risposte... - cleanupResp(currSession.SessionName); - // imposto livellotornando indietro di 1 alla volta... senza andare in negativoS - actLevel = actLevel - 1; - actLevel = actLevel > 0 ? actLevel : 0; - lgInfo($"Sessione inattiva, {actLevel + 1} --> {actLevel}"); + // controllo ultimo downgrade status + if (lastStatusDecr.AddSeconds(3) < adesso) + { + // elimino TUTTE le risposte... + cleanupResp(currSession.SessionName); + // registro downgrade status... + lastStatusDecr = adesso; + // imposto livellotornando indietro di 1 alla volta... senza andare in negativoS + actLevel = actLevel - 1; + actLevel = actLevel > 0 ? actLevel : 0; + lgInfo($"Sessione inattiva, {actLevel + 1} --> {actLevel}"); + } } } } @@ -747,6 +755,19 @@ namespace IOB_WIN lgError($"Lettura file stato in errore: trovate {numRow} linee"); } } + // se valido RILEGGO ultimo curr status + if (Last_CurrStatus.ValidUntil > adesso) + { + currStatus = Last_CurrStatus.Value; + } + } + else + { + // se valido RILEGGO ultimo curr status + if (Last_CurrStatus.ValidUntil > adesso) + { + currStatus = Last_CurrStatus.Value; + } } } else @@ -756,10 +777,14 @@ namespace IOB_WIN { currStatus = Last_CurrStatus.Value; } - else - { - actLevel = Eurom63.ComLevel.ChannelOk; - } + } + } + else + { + // se valido RILEGGO ultimo curr status + if (Last_CurrStatus.ValidUntil > adesso) + { + currStatus = Last_CurrStatus.Value; } } diff --git a/Jenkinsfile b/Jenkinsfile index 45594ac5..daf71d39 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=737']) { + withEnv(['NEXT_BUILD_NUMBER=738']) { // env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'