in ProcessManager/RequestReporter/CurrentProcessingUpsert.cs [27:83]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger logger)
{
AppInsightsLogger appInsightsLogger = new AppInsightsLogger(logger, LOGGING_SERVICE_NAME, LOGGING_SERVICE_VERSION);
var redisOperation = "increment";
if (req.Body != null)
{
string body = string.Empty;
try
{
using (StreamReader reader = new StreamReader(req.Body))
{
if (reader.BaseStream.Length > 0)
{
body = reader.ReadToEnd();
ProcessingUpdate update = null;
try
{
update = JsonConvert.DeserializeObject<ProcessingUpdate>(body);
}
catch
{
update = JsonConvert.DeserializeObject<ProcessingUpdate[]>(body)[0];
}
if (update == null)
{
appInsightsLogger.LogWarning("Parameters missing. Unable to update processing count.");
return new BadRequestResult();
}
else
{
return await RedisUpsert(update, appInsightsLogger, redisOperation);
}
}
else
{
appInsightsLogger.LogWarning("Parameters missing. Unable to update processing count.");
return new BadRequestResult();
}
}
}
catch (Exception ex)
{
appInsightsLogger.LogError(ex);
appInsightsLogger.LogRedisUpsert("Redis upsert failed.", redisOperation, DateTime.UtcNow.ToString(), body);
return new StatusCodeResult(500);
}
}
else
{
return new BadRequestResult();
}
}