From a78b2d0156d7a6574f118af6d91e9241f15caaba Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 10 Jan 2019 19:24:09 +0100 Subject: [PATCH] Tolta gestione pestDataLayer x prevenire evetuali altri errori e blocchi --- IOB-WIN/AdapterForm.cs | 57 +++++------------------------------------- IOB-WIN/App.config | 1 + IOB-WIN/IobGeneric.cs | 21 ++++++++++------ Jenkinsfile | 2 +- 4 files changed, 22 insertions(+), 59 deletions(-) diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs index 6bd873eb..6d1ce780 100644 --- a/IOB-WIN/AdapterForm.cs +++ b/IOB-WIN/AdapterForm.cs @@ -185,10 +185,6 @@ namespace IOB_WIN loadIniFile(defConfFilePath); lgInfo("INI LOADED"); - loadPersistLayer(utils.defPersLayerFile); - lgInfo("PersLayerFile READ"); - iobObj.loadPersData(); - lgInfo("PersLayerFile LOADED"); } catch (Exception exc) { @@ -381,8 +377,7 @@ namespace IOB_WIN if (iobObj.adpTryRestart && currWait > utils.CRI("waitRecMSec")) { lastStartTry = DateTime.Now; - iobObj.tryConnect(); - iobObj.loadPersData(); + iobObj.tryConnect(); } } } @@ -397,8 +392,7 @@ namespace IOB_WIN if (iobObj.adpTryRestart && currWait > utils.CRI("waitRecMSec")) { lastStartTry = DateTime.Now; - avviaAdapter(chkForceDequeue.Checked); - iobObj.loadPersData(); + avviaAdapter(chkForceDequeue.Checked); } } } @@ -548,40 +542,7 @@ namespace IOB_WIN // abbasso semaforo salvataggio iobObj.adpSaving = false; } - } - /// - /// Carica da file l'oggetto di persistenza dati - /// - /// - public void loadPersistLayer(string filePath) - { - // inizializzo prima di leggere... - iobObj.persistenceLayer = new Dictionary(); - iobObj.persistenceLayer = utils.ReadPlain(filePath); - - // 2017.03.23 check problema files corrotti... - if (iobObj.persistenceLayer.Count == 0) - { - // se avesse letto un valore NON coerente (senza righe) PROVA a leggere a ritroso vecchi files... da histPersLayerFile e precedenti... - int numDD = 0; - int maxNumDD = utils.CRI("maxNumDD"); - Dictionary lastRead = new Dictionary(); - // continuo fino a che non leggo almeno 1 riga valida e non ho raggiunto maxDD - while (numDD < maxNumDD && lastRead.Count == 0) - { - // leggo il file storico alla data anticipata... (ci provo...) - try - { - lastRead = utils.ReadPlain(utils.prevPersLayerFile(numDD)); - } - catch - { } - numDD++; - } - // se sono uscito PROVO a passare il file storico letto buono (oppure vuoto...) - iobObj.persistenceLayer = lastRead; - } - } + } #endregion @@ -606,11 +567,7 @@ namespace IOB_WIN { string iniConfFile = openFileDial.FileName; loadIniFile(iniConfFile); - lgInfo("INI LOADED"); - loadPersistLayer(utils.defPersLayerFile); - lgInfo("PersLayerFile READ"); - iobObj.loadPersData(); - lgInfo("PersLayerFile LOADED"); + lgInfo("INI LOADED"); } } @@ -724,8 +681,7 @@ namespace IOB_WIN /// private void start_Click(object sender, EventArgs e) { - avviaAdapter(chkForceDequeue.Checked); - iobObj.loadPersData(); + avviaAdapter(chkForceDequeue.Checked); // salvo che ho avviato adapter lgInfo("Completato LOAD Adapter"); } @@ -797,8 +753,7 @@ namespace IOB_WIN loadIniFile(defConfFilePath); displayTaskAndLog("RESTARTING: Ini File Reloaded"); // faccio start... CON RESET delel code - avviaAdapter(true); - iobObj.loadPersData(); + avviaAdapter(true); displayTaskAndLog("RESTARTING: Adapter Started"); // resetto i data monitor... dataMonitor_0 = ""; diff --git a/IOB-WIN/App.config b/IOB-WIN/App.config index a6a5b395..d1e161c0 100644 --- a/IOB-WIN/App.config +++ b/IOB-WIN/App.config @@ -27,6 +27,7 @@ + diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index 7c161643..74845971 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -545,12 +545,6 @@ namespace IOB_WIN lgError("Errore server NON pronto in pzCntReload"); } } - /// - /// lettura file di persistenza - /// - public void loadPersData() - { - } /// /// Avvia l'adapter sulla porta richiesta @@ -1160,7 +1154,20 @@ namespace IOB_WIN /// /// Valore del num max invii consecutivi da coda... /// - protected int nMaxSend = 10; + protected int nMaxSend + { + get + { + int answ = 5; + try + { + answ = utils.CRI("nMaxSend"); + } + catch + { } + return answ; + } + } /// /// DateTime Ultimo valore simulazione generato /// diff --git a/Jenkinsfile b/Jenkinsfile index dc1c03fe..522c3483 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=336']) { + withEnv(['NEXT_BUILD_NUMBER=337']) { // env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'