Compare commits

...

3 Commits

Author SHA1 Message Date
Samuele Locatelli a4b01773ea Merge branch 'release/FixPrerenderMonAndStressTest' 2022-07-08 10:01:33 +02:00
Samuele Locatelli b076148e65 MON:
- Update con log esteso
- evitato server prerender x raddoppio pagina
- test stress (disabilitato)
2022-07-08 10:01:03 +02:00
Samuele Locatelli 02369f87f7 Merge tag 'UpgradeMapoCoreAll' into develop
Upgrade all MAPO-CORE
2022-07-07 18:58:43 +02:00
8 changed files with 116 additions and 112 deletions
+92 -104
View File
@@ -1,39 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using MP.Mon;
using MP.Mon.Shared;
using MP.Mon.Components;
using MP.Data.DatabaseModels;
using MP.Data.Conf; using MP.Data.Conf;
using MP.Data.DatabaseModels;
using NLog;
namespace MP.Mon.Components namespace MP.Mon.Components
{ {
public partial class DetailMSE public partial class DetailMSE
{ {
#region Protected Fields
protected string baseCss = "sem";
protected int kaFactor = 60 / 2;
#endregion Protected Fields
#region Private Fields
private static System.Timers.Timer aTimer = new System.Timers.Timer(60 * 1000);
#endregion Private Fields
#region Public Properties #region Public Properties
[Parameter] [Parameter]
@@ -56,6 +29,80 @@ namespace MP.Mon.Components
#endregion Public Properties #endregion Public Properties
#region Public Methods
public void Dispose()
{
aTimer.Stop();
aTimer.Dispose();
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
Log.Trace($"Elapsed Timer {CurrRecord?.CodMacchina}");
await Task.Delay(1);
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
}
public void StartTimer()
{
int tOutPeriod = 1000;
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Fields
protected string baseCss = "sem";
protected int kaFactor = 60 / 2;
#endregion Protected Fields
#region Protected Properties
protected string codIOB
{
get
{
string answ = "";
if (CurrRecord != null)
{
answ = CurrRecord.IdxMacchina;
}
return answ;
}
}
protected bool dataLoaded { get; set; } = false;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// restituisce il valore data la tagLocation
/// </summary>
/// <param name="tagLocation"></param>
/// <returns></returns>
protected string currVal(string tagLocation)
{
string answ = "";
if (currTagVal.ContainsKey(tagLocation))
{
answ = currTagVal[tagLocation];
}
return answ;
}
/// <summary> /// <summary>
/// Verifica se ci sia un override per la riga indicata /// Verifica se ci sia un override per la riga indicata
/// </summary> /// </summary>
@@ -75,6 +122,15 @@ namespace MP.Mon.Components
return answ; return answ;
} }
protected override async Task OnInitializedAsync()
{
StartTimer();
Random rnd = new Random();
await Task.Delay(rnd.Next(5));
setupConf();
dataLoaded = true;
}
/// <summary> /// <summary>
/// Restituisce (se presenti) valori di override per la riga indicata /// Restituisce (se presenti) valori di override per la riga indicata
/// </summary> /// </summary>
@@ -98,83 +154,15 @@ namespace MP.Mon.Components
return rowVals; return rowVals;
} }
/// <summary>
/// restituisce il valore data la tagLocation
/// </summary>
/// <param name="tagLocation"></param>
/// <returns></returns>
protected string currVal(string tagLocation)
{
string answ = "";
if (currTagVal.ContainsKey(tagLocation))
{
answ = currTagVal[tagLocation];
}
return answ;
}
#region Protected Properties
protected string codIOB
{
get
{
string answ = "";
if (CurrRecord != null)
{
answ = CurrRecord.IdxMacchina;
}
return answ;
}
}
protected bool dataLoaded { get; set; } = false;
#endregion Protected Properties
#region Public Methods
public void Dispose()
{
aTimer.Stop();
aTimer.Dispose();
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
await Task.Delay(1);
await InvokeAsync(StateHasChanged);
});
pUpd.Wait();
}
public void StartTimer()
{
int tOutPeriod = 1000;
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Methods
protected override async Task OnInitializedAsync()
{
StartTimer();
Random rnd = new Random();
await Task.Delay(rnd.Next(5));
dataLoaded = true;
setupConf();
}
#endregion Protected Methods #endregion Protected Methods
#region Private Fields
private static System.Timers.Timer aTimer { get; set; } = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Methods #region Private Methods
private string cssComStatus(string semaforo, DateTime? lastUpdateN) private string cssComStatus(string semaforo, DateTime? lastUpdateN)
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Version>6.15.2207.718</Version> <Version>6.15.2207.810</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+1 -1
View File
@@ -29,7 +29,7 @@
layout="${longdate} ${uppercase:${level}} ${message}" /> layout="${longdate} ${uppercase:${level}} ${message}" />
--> -->
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" /> <target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" /> <target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" />
</targets> </targets>
<rules> <rules>
+18 -2
View File
@@ -64,7 +64,8 @@ namespace MP.Mon.Pages
var pUpd = Task.Run(async () => var pUpd = Task.Run(async () =>
{ {
await ReloadData(); await ReloadData();
//await Task.Delay(1); await Task.Delay(1);
Log.Trace("Elapsed Fast Timer");
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
}); });
pUpd.Wait(); pUpd.Wait();
@@ -74,6 +75,7 @@ namespace MP.Mon.Pages
{ {
ListMSE = null; ListMSE = null;
await Task.Delay(1); await Task.Delay(1);
Log.Trace("Elapsed Slow Timer");
NavManager.NavigateTo(NavManager.Uri); NavManager.NavigateTo(NavManager.Uri);
} }
@@ -188,7 +190,21 @@ namespace MP.Mon.Pages
private async Task ReloadData() private async Task ReloadData()
{ {
ListMSE = await MMDataService.MseGetAll(); // hack: legge 4 volte i dati x stressare sistema
bool stressTest = false;
if (stressTest)
{
var singleData = await MMDataService.MseGetAll();
ListMSE = singleData.ToList();
for (int i = 0; i < 3; i++)
{
ListMSE.AddRange(singleData);
}
}
else
{
ListMSE = await MMDataService.MseGetAll();
}
} }
private async Task setupConf() private async Task setupConf()
+1 -1
View File
@@ -5,4 +5,4 @@
Layout = "_Layout"; Layout = "_Layout";
} }
<component type="typeof(App)" render-mode="ServerPrerendered" /> <component type="typeof(App)" render-mode="Server" />
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>Modulo MON MAPO</i> <i>Modulo MON MAPO</i>
<h4>Versione: 6.15.2207.718</h4> <h4>Versione: 6.15.2207.810</h4>
<br /> Note di rilascio: <br /> Note di rilascio:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
6.15.2207.718 6.15.2207.810
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<item> <item>
<version>6.15.2207.718</version> <version>6.15.2207.810</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url> <url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog> <changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>