Update comportamento watchdog ping

This commit is contained in:
Samuele Locatelli
2026-05-19 16:16:51 +02:00
parent 41a4294549
commit 3634d7e4ac
+6 -5
View File
@@ -65,7 +65,7 @@ namespace IOB_WIN_FORM.Iob
{
readSemafori(ref currDispData);
}
catch(Exception exc)
catch (Exception exc)
{
lgError($"Eccezione in processDisconnectedTask{Environment.NewLine}{exc}");
}
@@ -144,7 +144,9 @@ namespace IOB_WIN_FORM.Iob
}
sw.Stop();
// fermo per una quota del tempo di attesa previsto
Task.Delay(vetoCheckSec - (int)sw.ElapsedMilliseconds + 20);
int nextWait = vetoCheckSec * 1000 - (int)sw.ElapsedMilliseconds + 20;
nextWait = nextWait < 0 ? 10 : nextWait;
Task.Delay(nextWait);
}
public override void startAdapter(bool resetQueue)
@@ -168,8 +170,6 @@ namespace IOB_WIN_FORM.Iob
lgDebug($"PING: tryConnect step 01 | connectionOk: {connectionOk}");
if (!connectionOk)
{
//// resetto coda...
//QueuePing = new DataQueue("000", "QueuePing", false);
// controllo che il ping sia stato tentato almeno pingTestSec fa...
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
{
@@ -201,6 +201,7 @@ namespace IOB_WIN_FORM.Iob
{
// loggo no risposta ping ...
lgError("PING KO");
// 2026.05.19 aggiunta esecuzione disconnect
queueInEnabCurr = true;
processDisconnectedTask();
queueInEnabCurr = false;
@@ -240,7 +241,7 @@ namespace IOB_WIN_FORM.Iob
// controllo: se era spenta e risulta ping ok --> reset coda!
if (B_input == 0 && pingOk)
{
B_input = 1;
B_input = bInOn;
QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QueuePing", false, redisMan);
lgTrace($"QueuePing resetted on addTest");
}