Estensione metodi di lettura QUEUE
This commit is contained in:
@@ -128,8 +128,29 @@ namespace WebDoorCreator.API.Data
|
||||
return numReq;
|
||||
}
|
||||
|
||||
/// <summary> Get calculation request pending as Dictionary<string, string> --> (doorId,
|
||||
/// revnumb) </summary>
|
||||
/// <summary>
|
||||
/// Get # of calculation request processing
|
||||
/// </summary>
|
||||
public async Task<long> NumRequestProcessing()
|
||||
{
|
||||
long numReq = 0;
|
||||
string source = "REDIS";
|
||||
Dictionary<string, string> dictResult = new Dictionary<string, string>();
|
||||
// cerco da cache
|
||||
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
numReq = await redisDb.HashLengthAsync(currKey);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"NumRequestProcessing | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return numReq;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Queue request pending
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of DoorId, saveVersNumb</returns>
|
||||
public async Task<Dictionary<string, string>> RequestPending()
|
||||
{
|
||||
string source = "REDIS";
|
||||
@@ -153,6 +174,33 @@ namespace WebDoorCreator.API.Data
|
||||
Log.Debug($"RequestPending | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dictResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get Queue request processing
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of DoorId, saveVersNumb</returns>
|
||||
public async Task<Dictionary<string, string>> RequestProcessing()
|
||||
{
|
||||
string source = "REDIS";
|
||||
long numReq = 0;
|
||||
Dictionary<string, string> dictResult = new Dictionary<string, string>();
|
||||
// cerco da cache
|
||||
RedisKey currKey = new RedisKey(Constants.CALC_REQ_PROC);
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
numReq = redisDb.HashLength(currKey);
|
||||
if (numReq > 0)
|
||||
{
|
||||
var rawData = await redisDb.HashGetAllAsync(currKey);
|
||||
foreach (var item in rawData)
|
||||
{
|
||||
dictResult.Add($"{item.Name}", $"{item.Value}");
|
||||
}
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"RequestProcessing | {source} in: {ts.TotalMilliseconds} ms");
|
||||
return dictResult;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user