This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -9,10 +9,8 @@ namespace AyaNova.Util
|
||||
//Track processes and kill any that go past their expiry date
|
||||
internal static class ReportRenderManager
|
||||
{
|
||||
|
||||
//thread safe collection for unordered items, optimized for single thread produce/consume (which is the norm here) but supports multithread produce / consume (which is needed for separate cleanup job)
|
||||
internal static ConcurrentBag<ReportRenderInstanceInfo> _baginstances;// = new ConcurrentBag<ReportRenderInstanceInfo>();
|
||||
|
||||
|
||||
internal static ConcurrentBag<ReportRenderInstanceInfo> _baginstances;
|
||||
|
||||
static ReportRenderManager()
|
||||
{
|
||||
@@ -34,7 +32,7 @@ namespace AyaNova.Util
|
||||
|
||||
internal static void KillExpiredRenders(ILogger log)
|
||||
{
|
||||
log.LogDebug("Clear potential expired render jobs check");
|
||||
log.LogTrace("Clear potential expired render jobs check");
|
||||
//check for expired and remove
|
||||
var Instances = _baginstances.ToArray();
|
||||
var dtNow = DateTime.UtcNow;
|
||||
@@ -42,9 +40,9 @@ namespace AyaNova.Util
|
||||
{
|
||||
if (i.Expires < dtNow)
|
||||
{
|
||||
// #if (DEBUG)
|
||||
// log.LogInformation($"DBG: KillExpiredRenders attempting kill of expired process {i.ReporterProcessId}");
|
||||
// #endif
|
||||
|
||||
log.LogDebug($"attempting close of expired process {i.ReporterProcessId}");
|
||||
|
||||
ForceCloseProcess(i, log);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +54,7 @@ namespace AyaNova.Util
|
||||
try
|
||||
{
|
||||
var p = Process.GetProcessById(instance.ReporterProcessId);
|
||||
|
||||
|
||||
if (p != null)
|
||||
{
|
||||
//we have an existing process
|
||||
@@ -64,7 +62,7 @@ namespace AyaNova.Util
|
||||
p.Kill(true);
|
||||
if (p.HasExited == false)
|
||||
{
|
||||
log.LogDebug($"Expired report render instance id {instance.ReporterProcessId} could not be force closed");
|
||||
log.LogWarning($"Expired report render instance id {instance.ReporterProcessId} could not be force closed");
|
||||
return false;//can't kill it so can't free up a slot
|
||||
}
|
||||
}
|
||||
@@ -87,21 +85,14 @@ namespace AyaNova.Util
|
||||
|
||||
internal static void AddProcess(int processId, DateTime expires, ILogger log)
|
||||
{
|
||||
// #if (DEBUG)
|
||||
// log.LogInformation($"DBG: RenderSlotAvailable::AddProcess {processId} in the bag");
|
||||
// #endif
|
||||
log.LogTrace($"AddProcess - {processId} to the collection");
|
||||
_baginstances.Add(new ReportRenderInstanceInfo(processId, expires));
|
||||
|
||||
// #if (DEBUG)
|
||||
// log.LogInformation($"DBG: RenderSlotAvailable::AddProcess, there are currently {_baginstances.Count} instances in the bag");
|
||||
// #endif
|
||||
log.LogInformation($"AddProcess - there are currently {_baginstances.Count} instances in the collection");
|
||||
}
|
||||
|
||||
internal static void RemoveProcess(int processId, ILogger log)
|
||||
{
|
||||
// #if (DEBUG)
|
||||
// log.LogInformation($"DBG: RenderSlotAvailable::RemoveProcess {processId} from the bag");
|
||||
// #endif
|
||||
foreach (var i in _baginstances)
|
||||
{
|
||||
if (i.ReporterProcessId == processId)
|
||||
|
||||
Reference in New Issue
Block a user