Rrefresh automatico stati Feeder
This commit is contained in:
@@ -6,6 +6,7 @@ using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
@@ -136,18 +137,18 @@ namespace MP.Data.Controllers
|
||||
/// Elenco da tabella MappaStatoExplModel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DbModels.MappaStatoExplModel> MseGetAll(int maxAge = 2000)
|
||||
public async Task<List<MappaStatoExplModel>> MseGetAllAsync(int maxAge = 2000)
|
||||
{
|
||||
List<DbModels.MappaStatoExplModel> dbResult = new List<DbModels.MappaStatoExplModel>();
|
||||
List<MappaStatoExplModel> dbResult = new List<DbModels.MappaStatoExplModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
|
||||
|
||||
dbResult = dbCtx
|
||||
dbResult = await dbCtx
|
||||
.DbSetMSE
|
||||
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,15 @@ namespace MP.Data.Services
|
||||
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("MP.Mon");
|
||||
// se non trovo cerco con MP.All...
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
{
|
||||
Log.Error("ConnString empty!");
|
||||
connStr = _configuration.GetConnectionString("MP.All");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
{
|
||||
Log.Error("ConnString empty! [MP.Mon / MP.All]");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -329,7 +335,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
result = await dbController.MseGetAllAsync(maxAge);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, UltraFastCache);
|
||||
@@ -339,7 +345,7 @@ namespace MP.Data.Services
|
||||
result = new List<MappaStatoExplModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
Log.Debug($"MseGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user