Rimozione doppie letture x blink inutilizzato in basePage
This commit is contained in:
@@ -368,6 +368,7 @@ namespace MP_TAB3.Components
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// controllo variazione parametri...
|
||||
string lastIMS = LastIdxMacchSub;
|
||||
if (paramsChanged())
|
||||
{
|
||||
saveParams();
|
||||
@@ -376,7 +377,9 @@ namespace MP_TAB3.Components
|
||||
// controllo SE ho variazioni così rileggo
|
||||
if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null)
|
||||
{
|
||||
RecMSESub = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, true);
|
||||
// solo se cambia macchina forzo da DB
|
||||
bool doForce = lastIMS != IdxMacchSub;
|
||||
RecMSESub = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, doForce);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -403,7 +406,7 @@ namespace MP_TAB3.Components
|
||||
|
||||
protected void setGaugeVals()
|
||||
{
|
||||
if (RecMSE != null)
|
||||
if (CRecMSE != null)
|
||||
{
|
||||
innerCircleVals.Clear();
|
||||
outerCircleVals.Clear();
|
||||
@@ -497,7 +500,10 @@ namespace MP_TAB3.Components
|
||||
{
|
||||
currOdl = await TabDServ.OdlByIdx(currPodl.IdxOdl, false);
|
||||
}
|
||||
await updateIdxOdl();
|
||||
if (!string.IsNullOrEmpty(IdxMaccMain))
|
||||
{
|
||||
await updateIdxOdl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2503.715</Version>
|
||||
<Version>6.16.2503.716</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -12,6 +12,17 @@ namespace MP_TAB3.Pages
|
||||
/// </summary>
|
||||
public partial class BasePage : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private bool doBlink = false;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime ultimo salvataggio in LocalStorage
|
||||
/// </summary>
|
||||
private DateTime lastSave = DateTime.Now;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
@@ -42,7 +53,6 @@ namespace MP_TAB3.Pages
|
||||
IdxMacc = "";
|
||||
CurrMSE = null;
|
||||
TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage;
|
||||
TDFeeder.blinkPipe.EA_NewMessage -= BlinkPipe_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -57,7 +67,6 @@ namespace MP_TAB3.Pages
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
TDFeeder.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage;
|
||||
TDFeeder.blinkPipe.EA_NewMessage += BlinkPipe_EA_NewMessage;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
@@ -121,47 +130,8 @@ namespace MP_TAB3.Pages
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool doBlink = false;
|
||||
|
||||
/// <summary>
|
||||
/// DateTime ultimo salvataggio in LocalStorage
|
||||
/// </summary>
|
||||
private DateTime lastSave = DateTime.Now;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Ricezione evento blink
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void BlinkPipe_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly List<string> --> allarmi
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
try
|
||||
{
|
||||
var dataRaw = JsonConvert.DeserializeObject<string>(currArgs.newMessage);
|
||||
if (dataRaw != null)
|
||||
{
|
||||
bool.TryParse($"{dataRaw}", out doBlink);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ricevuto nuovi dati da mostrare!
|
||||
/// </summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2503.715</h4>
|
||||
<h4>Versione: 6.16.2503.716</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2503.715
|
||||
6.16.2503.716
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2503.715</version>
|
||||
<version>6.16.2503.716</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -1285,7 +1285,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
redisDb.StringSet(currKey, rawData, UltraFastCache);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
|
||||
@@ -1344,7 +1344,7 @@ namespace MP.Data.Services
|
||||
result = new ODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlByIdx | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
Log.Debug($"OdlByIdx | {idxOdl} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1382,28 +1382,36 @@ namespace MP.Data.Services
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ODLExpModel result = new ODLExpModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
// se vuoto esco subito...
|
||||
if (!string.IsNullOrEmpty(idxMacchina))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLExpModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLExpModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina));
|
||||
result = listRes.FirstOrDefault();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new ODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlCurrByMacc | {source} | {idxMacchina} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
}
|
||||
else
|
||||
{
|
||||
var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina));
|
||||
result = listRes.FirstOrDefault();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
Log.Trace("idxMacchina vuoto!");
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new ODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlCurrByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1928,7 +1936,7 @@ namespace MP.Data.Services
|
||||
result = new PODLExpModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"PODL_getByKey | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
Log.Debug($"PODL_getByKey | {idxPODL} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user