Merge remote-tracking branch 'gitlab.steamware/develop' into develop
This commit is contained in:
Binary file not shown.
@@ -9,6 +9,7 @@
|
||||
<add key="checkPeriod" value="250" />
|
||||
<add key="chekMult" value="3" />
|
||||
<add key="watchDogMult" value="60" />
|
||||
<add key="forceCheckMult" value="10" />
|
||||
<add key="autoRestartTimeoutMin" value="15" />
|
||||
<add key="autoStartProc" value="true" />
|
||||
<add key="closeOnChildUpdate" value="true" />
|
||||
|
||||
+154
-62
@@ -28,6 +28,15 @@ namespace IOB_MAN
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Token x cancellazione thread
|
||||
/// </summary>
|
||||
private CancellationTokenSource _cts;
|
||||
/// <summary>
|
||||
/// Context x sync thread
|
||||
/// </summary>
|
||||
private readonly SynchronizationContext synchronizationContext;
|
||||
|
||||
/// <summary>
|
||||
/// Totale processi avviati
|
||||
/// </summary>
|
||||
@@ -41,6 +50,10 @@ namespace IOB_MAN
|
||||
/// </summary>
|
||||
protected int watchDogMult = 75;
|
||||
/// <summary>
|
||||
/// Counter x il force check status
|
||||
/// </summary>
|
||||
protected int forceCheckMult = 10;
|
||||
/// <summary>
|
||||
/// Counter per verifica processi (ogni volta che va a zero faccio vero check)
|
||||
/// </summary>
|
||||
protected int chekMult = 4;
|
||||
@@ -72,9 +85,14 @@ namespace IOB_MAN
|
||||
/// semaforo check...
|
||||
/// </summary>
|
||||
protected bool checkRunning = false;
|
||||
|
||||
protected bool doTaskRun = true;
|
||||
protected bool doParallel = true;
|
||||
|
||||
public IOBManPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
synchronizationContext = SynchronizationContext.Current;
|
||||
myInit();
|
||||
updateStatus();
|
||||
}
|
||||
@@ -86,7 +104,7 @@ namespace IOB_MAN
|
||||
lblVers.Text = string.Format(" v.{0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
|
||||
// init prog bar
|
||||
tsProgBar.Maximum = 100;
|
||||
tsProgBar.Step = 1;
|
||||
tsProgBar.Step = 2;
|
||||
// gestione eventi binding source
|
||||
ElencoIOB.AddingNew += ElencoIOB_AddingNew;
|
||||
ElencoIOB.ListChanged += ElencoIOB_ListChanged;
|
||||
@@ -180,45 +198,48 @@ namespace IOB_MAN
|
||||
|
||||
private void updateStatus()
|
||||
{
|
||||
// aggiorno labels
|
||||
tsslNumProc.Text = $"Configurati {ArgsList.Count} processi | Avviati: {numProcAvviati} | Attivi: {numProcRunning}";
|
||||
bool hlRestart = false;
|
||||
// colore da num proc...
|
||||
if (numProcRunning == ArgsList.Count)
|
||||
synchronizationContext.Post(new SendOrPostCallback(o =>
|
||||
{
|
||||
tsslNumProc.ForeColor = Color.Green;
|
||||
}
|
||||
else if (numProcAvviati < ArgsList.Count)
|
||||
{
|
||||
tsslNumProc.ForeColor = Color.DarkRed;
|
||||
hlRestart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsslNumProc.ForeColor = Color.OrangeRed;
|
||||
hlRestart = true;
|
||||
}
|
||||
// fix autorestart...
|
||||
if (hlRestart)
|
||||
{
|
||||
chkAutoRestart.ForeColor = System.Drawing.Color.Red;
|
||||
chkAutoRestart.Text = "Auto Restart!!!";
|
||||
txtTOutAutoCheck.Visible = true;
|
||||
btnMoreTOut.Visible = true;
|
||||
// se NON checked aggiorno contatore...
|
||||
if (!chkAutoRestart.Checked)
|
||||
// aggiorno labels
|
||||
tsslNumProc.Text = $"Configurati {ArgsList.Count} processi | Avviati: {numProcAvviati} | Attivi: {numProcRunning}";
|
||||
bool hlRestart = false;
|
||||
// colore da num proc...
|
||||
if (numProcRunning == ArgsList.Count)
|
||||
{
|
||||
tOutAutocheck--;
|
||||
txtTOutAutoCheck.Text = (tOutAutocheck / (1000 / (utils.CRI("checkPeriod") * utils.CRI("chekMult")))).ToString();
|
||||
tsslNumProc.ForeColor = Color.Green;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chkAutoRestart.ForeColor = DefaultForeColor;
|
||||
chkAutoRestart.Text = "Auto Restart";
|
||||
txtTOutAutoCheck.Visible = false;
|
||||
btnMoreTOut.Visible = false;
|
||||
}
|
||||
else if (numProcAvviati < ArgsList.Count)
|
||||
{
|
||||
tsslNumProc.ForeColor = Color.DarkRed;
|
||||
hlRestart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsslNumProc.ForeColor = Color.OrangeRed;
|
||||
hlRestart = true;
|
||||
}
|
||||
// fix autorestart...
|
||||
if (hlRestart)
|
||||
{
|
||||
chkAutoRestart.ForeColor = System.Drawing.Color.Red;
|
||||
chkAutoRestart.Text = "Auto Restart!!!";
|
||||
txtTOutAutoCheck.Visible = true;
|
||||
btnMoreTOut.Visible = true;
|
||||
// se NON checked aggiorno contatore...
|
||||
if (!chkAutoRestart.Checked)
|
||||
{
|
||||
tOutAutocheck--;
|
||||
txtTOutAutoCheck.Text = (tOutAutocheck / (1000 / (utils.CRI("checkPeriod") * utils.CRI("chekMult")))).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chkAutoRestart.ForeColor = DefaultForeColor;
|
||||
chkAutoRestart.Text = "Auto Restart";
|
||||
txtTOutAutoCheck.Visible = false;
|
||||
btnMoreTOut.Visible = false;
|
||||
}
|
||||
}), "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -356,13 +377,22 @@ namespace IOB_MAN
|
||||
private void MainTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
updateProgBar();
|
||||
if (!checkRunning)
|
||||
if (!checkRunning && forceCheckMult > 0)
|
||||
{
|
||||
chekProcessStatusAsync();
|
||||
forceCheckMult = utils.CRI("forceCheckMult");
|
||||
if (doTaskRun)
|
||||
{
|
||||
checkProcessStatusAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
checkProcessStatus();
|
||||
}
|
||||
checkWatchdog();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
forceCheckMult--;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -424,14 +454,39 @@ namespace IOB_MAN
|
||||
/// <summary>
|
||||
/// Controllo periodico dei processi attivi
|
||||
/// </summary>
|
||||
private async Task chekProcessStatusAsync()
|
||||
private void checkProcessStatus()
|
||||
{
|
||||
chekMult--;
|
||||
if (chekMult < 0)
|
||||
{
|
||||
checkRunning = true;
|
||||
// reset variabili appoggio
|
||||
chekMult = utils.CRI("chekMult");
|
||||
await Task.Run(() => checkRunningchild());
|
||||
checkRunning = true;
|
||||
// eseguo task!
|
||||
checkRunningchild();
|
||||
updateStatus();
|
||||
checkRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controllo periodico dei processi attivi
|
||||
/// </summary>
|
||||
private async Task checkProcessStatusAsync()
|
||||
{
|
||||
chekMult--;
|
||||
if (chekMult < 0)
|
||||
{
|
||||
// reset variabili appoggio
|
||||
chekMult = utils.CRI("chekMult");
|
||||
checkRunning = true;
|
||||
// eseguo task!
|
||||
//var taskRes = Task.Run(() => checkRunningchild());
|
||||
//taskRes.Wait();
|
||||
|
||||
await Task.Run(() => checkRunningchild()).ConfigureAwait(false);
|
||||
|
||||
updateStatus();
|
||||
checkRunning = false;
|
||||
}
|
||||
}
|
||||
@@ -451,39 +506,76 @@ namespace IOB_MAN
|
||||
private void checkRunningchild()
|
||||
{
|
||||
List<iobAdapt> item2rem = new List<iobAdapt>();
|
||||
IList<iobAdapt> allItems = (IList<iobAdapt>)ElencoIOB.List;
|
||||
bool needRem = false;
|
||||
|
||||
numProcRunning = numProcAvviati;
|
||||
|
||||
// 2020.02.01 passato chiamata specifica x leggere in 1 sola volta TUTTO elenco processi (x nome)...
|
||||
Process[] processList = Process.GetProcessesByName(TargetName);
|
||||
// ciclo
|
||||
foreach (iobAdapt item in ElencoIOB.List)
|
||||
if (doParallel)
|
||||
{
|
||||
// verifico se esista il processo...
|
||||
try
|
||||
// ciclo
|
||||
Parallel.ForEach(allItems, item =>
|
||||
{
|
||||
Process p = myGetProcByID(processList, item.pID);
|
||||
needRem = p.HasExited;
|
||||
// verifico se esista il processo...
|
||||
try
|
||||
{
|
||||
if (processList.Length > 0)
|
||||
{
|
||||
Process p = myGetProcByID(processList, item.pID);
|
||||
needRem = p.HasExited;
|
||||
}
|
||||
else
|
||||
{
|
||||
needRem = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
needRem = true;
|
||||
}
|
||||
if (needRem)
|
||||
{
|
||||
item2rem.Add(item);
|
||||
item.isRunning = false;
|
||||
numProcRunning--;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.isRunning = true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (iobAdapt item in allItems)
|
||||
{
|
||||
needRem = true;
|
||||
}
|
||||
if (needRem)
|
||||
{
|
||||
item2rem.Add(item);
|
||||
item.isRunning = false;
|
||||
numProcRunning--;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.isRunning = true;
|
||||
// verifico se esista il processo...
|
||||
try
|
||||
{
|
||||
Process p = myGetProcByID(processList, item.pID);
|
||||
needRem = p.HasExited;
|
||||
}
|
||||
catch
|
||||
{
|
||||
needRem = true;
|
||||
}
|
||||
if (needRem)
|
||||
{
|
||||
item2rem.Add(item);
|
||||
item.isRunning = false;
|
||||
numProcRunning--;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.isRunning = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// aggiorno datagrid!
|
||||
dgvManagedItems.Invalidate();
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void IOBManPanel_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ pipeline {
|
||||
steps {
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=660']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=661']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'MAPO-IOB-WIN'
|
||||
|
||||
Reference in New Issue
Block a user