Merge branch 'Release/FixCacheSemaphore_01'
This commit is contained in:
@@ -465,22 +465,10 @@ namespace MP.Data.Services.IOC
|
||||
return cachedValue!;
|
||||
}
|
||||
|
||||
await _semaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
if (_cache.TryGetValue(cacheKey, out cachedValue))
|
||||
{
|
||||
return cachedValue!;
|
||||
}
|
||||
|
||||
T newValue = await fetchFunc();
|
||||
_cache.Set(cacheKey, newValue, expiration);
|
||||
return newValue;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
// se non trovato procedo as usual...
|
||||
T newValue = await fetchFunc();
|
||||
_cache.Set(cacheKey, newValue, expiration);
|
||||
return newValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -834,9 +822,7 @@ namespace MP.Data.Services.IOC
|
||||
//double numSecCache = ((result["insEnabled"].ToLower() == "true") ? redisShortTimeCache : redisLongTimeCache);
|
||||
numSecCache = dbResult.InsEnabled ? redisShortTimeCache : redisLongTimeCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
// dati master/slave
|
||||
string isMaster = (await ListMasterAsync()).Contains(idxMacc) ? "1" : "0";
|
||||
string isSlave = (await ListSlaveAsync()).Contains(idxMacc) ? "1" : "0";
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</th>
|
||||
<th>Metodo</th>
|
||||
<th class="text-start">IO %</th>
|
||||
<th class="text-center">Balance</th>
|
||||
<th class="text-end">IOC %</th>
|
||||
<th class="text-start"><button class="btn btn-sm btn-warning" @onclick="() => SetAllWeight(0)" title="ALL 100% IO"><i class="fa-solid fa-scale-unbalanced"></i></button> IO % </th>
|
||||
<th class="text-center">Balance <button class="btn btn-sm btn-success" @onclick="() => SetAllWeight(50)" title="ALL 50%"><i class="fa-solid fa-scale-balanced"></i></button> Balance</th>
|
||||
<th class="text-end">IOC % <button class="btn btn-sm btn-info" @onclick="() => SetAllWeight(100)" title="ALL 100% IOC"><i class="fa-solid fa-scale-unbalanced-flip"></i></button></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -55,9 +55,9 @@
|
||||
@record.OldWeight
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-sm btn-warning" @onclick="() => SetNewWeight(record, record.NewWeight - 10)" title="Seto 50%">+10%</button>
|
||||
<button class="btn btn-sm btn-success" @onclick="() => SetNewWeight(record, 50)" title="Seto 50%"><i class="fa-solid fa-scale-balanced"></i></button>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => SetNewWeight(record, record.NewWeight + 10)" title="Seto 50%">+10%</button>
|
||||
<button class="btn btn-sm btn-warning" @onclick="() => SetNewWeight(record, record.NewWeight - 10)" title="Set +10%">+10%</button>
|
||||
<button class="btn btn-sm btn-success" @onclick="() => SetNewWeight(record, 50)" title="Set 50%"><i class="fa-solid fa-scale-balanced"></i></button>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => SetNewWeight(record, record.NewWeight + 10)" title="Set +10%">+10%</button>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
@record.NewWeight
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Core.DTO;
|
||||
using MP.IOC.Services;
|
||||
|
||||
@@ -13,6 +14,9 @@ namespace MP.IOC.Components.Pages
|
||||
get => string.IsNullOrEmpty(SearchVal) ? "btn-outline-secondary" : "btn-primary";
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
protected string SearchVal
|
||||
{
|
||||
get => _searchVal;
|
||||
@@ -88,25 +92,6 @@ namespace MP.IOC.Components.Pages
|
||||
SelRecord = curRec;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposta il peso del metodo "New" come richiesto, con eventuale check sui limiti 0-100
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
/// <param name="newWeight"></param>
|
||||
private async Task SetNewWeight(WeightDTO curRec, int newWeight)
|
||||
{
|
||||
newWeight = Math.Clamp(newWeight, 0, 100);
|
||||
curRec.NewWeight = newWeight;
|
||||
curRec.OldWeight = 100 - newWeight;
|
||||
// salvo!
|
||||
WService.UpsertWeight(curRec);
|
||||
// rileggo!
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void DoReset()
|
||||
{
|
||||
SelRecord = null;
|
||||
@@ -136,6 +121,45 @@ namespace MP.IOC.Components.Pages
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposta globalmente weight x tutte le chiavi...
|
||||
/// </summary>
|
||||
/// <param name="newWeight"></param>
|
||||
/// <returns></returns>
|
||||
private async Task SetAllWeight(int newWeight)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler impostare questo peso per TUTTE le chiamate?"))
|
||||
return;
|
||||
|
||||
newWeight = Math.Clamp(newWeight, 0, 100);
|
||||
foreach (var curRec in ListComplete)
|
||||
{
|
||||
curRec.NewWeight = newWeight;
|
||||
curRec.OldWeight = 100 - newWeight;
|
||||
WService.UpsertWeight(curRec);
|
||||
}
|
||||
// rileggo!
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposta il peso del metodo "New" come richiesto, con eventuale check sui limiti 0-100
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
/// <param name="newWeight"></param>
|
||||
private async Task SetNewWeight(WeightDTO curRec, int newWeight)
|
||||
{
|
||||
newWeight = Math.Clamp(newWeight, 0, 100);
|
||||
curRec.NewWeight = newWeight;
|
||||
curRec.OldWeight = 100 - newWeight;
|
||||
// salvo!
|
||||
WService.UpsertWeight(curRec);
|
||||
// rileggo!
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
private void UpdateTable()
|
||||
{
|
||||
// effettuo eventuale ricerca + conteggio...
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>8.16.2605.811</Version>
|
||||
<Version>8.16.2605.1112</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 8.16.2605.811</h4>
|
||||
<h4>Versione: 8.16.2605.1112</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2605.811
|
||||
8.16.2605.1112
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2605.811</version>
|
||||
<version>8.16.2605.1112</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user