diff --git a/CVCncLib/testSam.dll b/CVCncLib/testSam.dll
index 4fa74bea..430d1770 100644
Binary files a/CVCncLib/testSam.dll and b/CVCncLib/testSam.dll differ
diff --git a/IOB-UT/baseUtils.cs b/IOB-UT/baseUtils.cs
index e582bba9..86ecc064 100644
--- a/IOB-UT/baseUtils.cs
+++ b/IOB-UT/baseUtils.cs
@@ -16,7 +16,7 @@ namespace IOB_UT
{
///
- /// Override metodo WebCLient con gesitone TimeOut corto
+ /// Override metodo WebClient con gesitone TimeOut corto
///
public class WebClientWT : WebClient
{
@@ -518,13 +518,68 @@ namespace IOB_UT
}
return answ;
}
+ ///
+ /// Effettua chiamata URL e restituisce risultato
+ ///
+ ///
+ ///
+ ///
+ public static string callUrl(string URL, string payload)
+ {
+ string answ = "";
+ // controllo se ho un VETO all'invio...
+ if (dtVetoSend < DateTime.Now)
+ {
+ var client = new WebClientWT();
+ //var client = new WebClient();
+ client.Headers.Add("user-agent", CRS("appName"));
+ try
+ {
+ answ = client.UploadString(URL, payload);
+ }
+ catch (Exception exc)
+ {
+ // imposto veto
+ int pauseSendMSec = nextPauseSendMSec;
+ dtVetoSend = DateTime.Now.AddMilliseconds(pauseSendMSec);
+ // log ogni
+ lg.Info($"Errore in callURL con PAYLOAD verso {URL}: impostato attesa di {pauseSendMSec} ms prima della prossima chiamata");
+ logReduxFactor--;
+ if (logReduxFactor <= 0)
+ {
+ lg.Error("Eccezione in esecuzione callURL: {0}{1}{2}", URL, Environment.NewLine, exc);
+ logReduxFactor = 10;
+ }
+ }
+ }
+ // restituisco valore!
+ return answ;
+ }
+ ///
+ /// Versione async della chiamata ad URL
+ ///
+ ///
+ ///
public static string callUrlAsync(string URL)
{
// Chiamo in modalità task...
var resp = TaskEx.Run(() => callUrl(URL));
return resp.Result;
}
+ ///
+ /// Versione async della chiamata ad URL
+ ///
+ ///
+ ///
+ ///
+ public static string callUrlAsync(string URL, string payload)
+ {
+ // Chiamo in modalità task...
+ var resp = TaskEx.Run(() => callUrl(URL, payload));
+ return resp.Result;
+ }
+
///
/// provvede a verificare la dim della cartella dei log e cancella i + vecchi fino a restare a dim inferiori a _logMaxMb
diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs
index bf3e493a..4e8afa77 100644
--- a/IOB-WIN/IobGeneric.cs
+++ b/IOB-WIN/IobGeneric.cs
@@ -1983,19 +1983,16 @@ namespace IOB_WIN
///
public string callUrlWithPayload(string URL, string payload, bool doAsync)
{
- //!!!FUXME!!!
string answ = "";
// Chiamata ASINCRONA
if (doAsync)
{
- //Task resp = utils.callUrlAsync(URL);
- //answ = resp.Result;
- answ = utils.callUrlAsync(URL);
+ answ = utils.callUrlAsync(URL, payload);
}
// chiamata SOLO NORMALE SINCRONA...
else
{
- answ = utils.callUrl(URL);
+ answ = utils.callUrl(URL, payload);
}
return answ;
}
@@ -2896,6 +2893,8 @@ namespace IOB_WIN
lastUrl = urlDataBlock(tipoUrl);
// in base al tipo di dato compongo il payload Json da inviare
string payload = jsonPayload(tipoUrl, listQueueVal);
+ // async a true SE FLog
+ bool doAsync = tipoUrl == urlType.FLog ? true : false;
// se NON sono in demo effettuo invio!
if (!DemoOut)
{
@@ -2903,7 +2902,7 @@ namespace IOB_WIN
if (checkServerAlive)
{
// chiamo URL!
- string answ = callUrlWithPayload(lastUrl, payload, false);
+ string answ = callUrlWithPayload(lastUrl, payload, doAsync);
// loggo!
lgInfo($"[SEND payload] {listQueueVal.Count} records --> {answ}");
// se "OK" verde, altrimenti errore --> ROSSO