mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Fix variable name conflict and change cache logs to DEBUG level
- Fixed CS0136 error: renamed 'doc' to 'extDoc' in AdminController to avoid variable name conflict - Changed all Redis cache logs (HIT/MISS/SET) to DEBUG level instead of suppressing - This allows cache logs to be visible in docker logs but not as noisy at INFO level
This commit is contained in:
@@ -537,18 +537,18 @@ public class AdminController : ControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
using var doc = JsonDocument.Parse(externalMappingJson);
|
||||
var root = doc.RootElement;
|
||||
using var extDoc = JsonDocument.Parse(externalMappingJson);
|
||||
var extRoot = extDoc.RootElement;
|
||||
|
||||
string? provider = null;
|
||||
string? externalId = null;
|
||||
|
||||
if (root.TryGetProperty("provider", out var providerEl))
|
||||
if (extRoot.TryGetProperty("provider", out var providerEl))
|
||||
{
|
||||
provider = providerEl.GetString();
|
||||
}
|
||||
|
||||
if (root.TryGetProperty("id", out var idEl))
|
||||
if (extRoot.TryGetProperty("id", out var idEl))
|
||||
{
|
||||
externalId = idEl.GetString();
|
||||
}
|
||||
@@ -674,12 +674,12 @@ public class AdminController : ControllerBase
|
||||
{
|
||||
try
|
||||
{
|
||||
using var doc = JsonDocument.Parse(externalMappingJson);
|
||||
var root = doc.RootElement;
|
||||
using var extDoc = JsonDocument.Parse(externalMappingJson);
|
||||
var extRoot = extDoc.RootElement;
|
||||
|
||||
string? provider = null;
|
||||
|
||||
if (root.TryGetProperty("provider", out var providerEl))
|
||||
if (extRoot.TryGetProperty("provider", out var providerEl))
|
||||
{
|
||||
provider = providerEl.GetString();
|
||||
}
|
||||
|
||||
@@ -58,28 +58,14 @@ public class RedisCacheService
|
||||
{
|
||||
var value = await _db!.StringGetAsync(key);
|
||||
|
||||
// Only log manual/external mapping HITs (not MISSes - they're expected)
|
||||
var isManualMapping = key.Contains(":manual-map:") || key.Contains(":external-map:");
|
||||
|
||||
if (value.HasValue)
|
||||
{
|
||||
if (isManualMapping)
|
||||
{
|
||||
_logger.LogInformation("Redis cache HIT: {Key}", key);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogDebug("Redis cache HIT: {Key}", key);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't log MISS for manual/external mappings - they're expected to be missing most of the time
|
||||
if (!isManualMapping)
|
||||
{
|
||||
_logger.LogDebug("Redis cache MISS: {Key}", key);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -119,18 +105,9 @@ public class RedisCacheService
|
||||
{
|
||||
var result = await _db!.StringSetAsync(key, value, expiry);
|
||||
if (result)
|
||||
{
|
||||
// Log manual/external mappings at INFO level, others at DEBUG
|
||||
var isManualMapping = key.Contains(":manual-map:") || key.Contains(":external-map:");
|
||||
if (isManualMapping)
|
||||
{
|
||||
_logger.LogInformation("Redis cache SET: {Key} (TTL: {Expiry})", key, expiry?.ToString() ?? "none");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogDebug("Redis cache SET: {Key} (TTL: {Expiry})", key, expiry?.ToString() ?? "none");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user