Migliorata gestione doppio webdriver + send in chiusura SOLO SE server alive

This commit is contained in:
Samuele E. Locatelli
2019-05-08 00:46:38 +02:00
parent 9963838b45
commit 5089ca080e
3 changed files with 23 additions and 16 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ CMDIOB2CALL=/IOB/getIob2call?GWIP=
[IOB]
;--- TEST SIMULAZIONE
;STARTLIST=WPS,WPS
STARTLIST=WPS
STARTLIST=WPS,WPS
;STARTLIST=WPS
;STARTLIST=SIMUL_01
;STARTLIST=3015
+17 -9
View File
@@ -649,7 +649,7 @@ namespace IOB_WIN
public virtual void stopAdapter(bool tryRestart, bool forceDequeue)
{
if (forceDequeue)
{
{
// svuoto le code dei valori letti e non ancora trasmessi...
parentForm.displayTaskAndLog("Svuotamento FORZATO coda segnali...");
while (QueueIN.Count > 0)
@@ -2496,18 +2496,26 @@ namespace IOB_WIN
// se NON sono in demo effettuo invio!
if (!DemoOut)
{
// chiamo URL!
string answ = callUrl(lastUrl);
// loggo!
lgInfo(string.Format("[SEND] {0} -> {1}", queueVal, answ));
// se "OK" verde, altrimenti errore --> ROSSO
if (answ == "OK")
// SE server alive...
if (checkServerAlive)
{
parentForm.sOUT = Semaforo.SV;
// chiamo URL!
string answ = callUrl(lastUrl);
// loggo!
lgInfo(string.Format("[SEND] {0} -> {1}", queueVal, answ));
// se "OK" verde, altrimenti errore --> ROSSO
if (answ == "OK")
{
parentForm.sOUT = Semaforo.SV;
}
else
{
parentForm.sOUT = Semaforo.SR;
}
}
else
{
parentForm.sOUT = Semaforo.SR;
lgInfo(string.Format("[SERVER KO] {0}", queueVal));
}
}
else
+4 -5
View File
@@ -3,7 +3,6 @@ using Newtonsoft.Json;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
using System.IO;
@@ -28,7 +27,7 @@ namespace IOB_WIN
/// <summary>
/// Vettore della frequenza di ogni status trovato... invio ogni 100 rilevazioni (modulo 100, resto == 1)
/// </summary>
protected Dictionary<string, int> freqUnknStatus= new Dictionary<string, int>();
protected Dictionary<string, int> freqUnknStatus = new Dictionary<string, int>();
/// <summary>
/// Pagina web da scaricare
/// </summary>
@@ -40,7 +39,7 @@ namespace IOB_WIN
/// <summary>
/// Driver per gestione chiamate crawling/scraping
/// </summary>
protected RemoteWebDriver driver;
protected IWebDriver driver;
/// <summary>
/// Oggetti decodificati da pagina
@@ -189,8 +188,8 @@ namespace IOB_WIN
try
{
// in primis chiudo driver...
if (driver != null)
{
if (driver != null && driver.WindowHandles.Count > 0)
{
driver.Quit();
}
}