Fixed method for WebAPI + signal-r interference

This commit is contained in:
Samuele Locatelli
2020-06-16 18:02:42 +02:00
parent 87703058ac
commit 928c0d20f9
4 changed files with 18 additions and 6 deletions
+2 -2
View File
@@ -917,7 +917,7 @@ public static class ThreadsFunctions
recipeRtCounter--;
bool onlyRt = recipeRtCounter > 0;
//check reset...
recipeRtCounter = recipeRtCounter < 0 ? 5 : recipeRtCounter;
recipeRtCounter = recipeRtCounter < 0 ? 4 : recipeRtCounter;
sw.Restart();
@@ -1021,7 +1021,7 @@ public static class ThreadsFunctions
// Update thread timer
UpdateStat(MethodBase.GetCurrentMethod().Name, sw.ElapsedMilliseconds);
// Wait
Thread.Sleep(CalcSleepTime(1000, (int)sw.ElapsedMilliseconds));
Thread.Sleep(CalcSleepTime(500, (int)sw.ElapsedMilliseconds));
}
}
catch (ThreadAbortException)
+13 -2
View File
@@ -147,6 +147,11 @@ namespace Thermo.Active.NC
#endregion
#region cached data
protected static Dictionary<string, DTORecipeParam> lastRecipe = new Dictionary<string, DTORecipeParam>();
#endregion
#region Read Data
@@ -1266,13 +1271,16 @@ namespace Thermo.Active.NC
{
Dictionary<int, ThermoModels.RecipeParam> currPlcRecipe = new Dictionary<int, ThermoModels.RecipeParam>();
CmsError cmsError = NO_ERROR;
if (useLastRead)
if (useLastRead && lastRecipe.Count > 0)
{
cmsError = numericalControl.PLC_RRecipeParamList(false, ref currPlcRecipe);
currentRecipe = lastRecipe;
return cmsError;
}
else
{
cmsError = numericalControl.PLC_RRecipeParamList(refreshOnlyRT, ref currPlcRecipe);
if (cmsError.IsError())
return cmsError;
}
if (cmsError.IsError())
@@ -1349,10 +1357,13 @@ namespace Thermo.Active.NC
}
currentRecipe.Add(item.Label, currParam);
}
// salvo!
lastRecipe = currentRecipe;
}
else
{
currentRecipe = new Dictionary<string, DTORecipeParam>();
lastRecipe = currentRecipe;
}
return NO_ERROR;
@@ -269,7 +269,8 @@ namespace Thermo.Active.Listeners.SignalR
// comparazione
if (!item.Value.Equals(LastRecipeFullData[item.Key]))
{
diffData[item.Key] = item.Value;
//diffData[item.Key] = item.Value;
diffData.Add(item.Key, item.Value);
}
}
}
+1 -1
View File
@@ -31,4 +31,4 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.7.5")]
[assembly: AssemblyVersion("0.8.1")]