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
|
//Track processes and kill any that go past their expiry date
|
||||||
internal static class ReportRenderManager
|
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;
|
||||||
internal static ConcurrentBag<ReportRenderInstanceInfo> _baginstances;// = new ConcurrentBag<ReportRenderInstanceInfo>();
|
|
||||||
|
|
||||||
|
|
||||||
static ReportRenderManager()
|
static ReportRenderManager()
|
||||||
{
|
{
|
||||||
@@ -34,7 +32,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
internal static void KillExpiredRenders(ILogger log)
|
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
|
//check for expired and remove
|
||||||
var Instances = _baginstances.ToArray();
|
var Instances = _baginstances.ToArray();
|
||||||
var dtNow = DateTime.UtcNow;
|
var dtNow = DateTime.UtcNow;
|
||||||
@@ -42,9 +40,9 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
if (i.Expires < dtNow)
|
if (i.Expires < dtNow)
|
||||||
{
|
{
|
||||||
// #if (DEBUG)
|
|
||||||
// log.LogInformation($"DBG: KillExpiredRenders attempting kill of expired process {i.ReporterProcessId}");
|
log.LogDebug($"attempting close of expired process {i.ReporterProcessId}");
|
||||||
// #endif
|
|
||||||
ForceCloseProcess(i, log);
|
ForceCloseProcess(i, log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,7 +54,7 @@ namespace AyaNova.Util
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var p = Process.GetProcessById(instance.ReporterProcessId);
|
var p = Process.GetProcessById(instance.ReporterProcessId);
|
||||||
|
|
||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
//we have an existing process
|
//we have an existing process
|
||||||
@@ -64,7 +62,7 @@ namespace AyaNova.Util
|
|||||||
p.Kill(true);
|
p.Kill(true);
|
||||||
if (p.HasExited == false)
|
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
|
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)
|
internal static void AddProcess(int processId, DateTime expires, ILogger log)
|
||||||
{
|
{
|
||||||
// #if (DEBUG)
|
log.LogTrace($"AddProcess - {processId} to the collection");
|
||||||
// log.LogInformation($"DBG: RenderSlotAvailable::AddProcess {processId} in the bag");
|
|
||||||
// #endif
|
|
||||||
_baginstances.Add(new ReportRenderInstanceInfo(processId, expires));
|
_baginstances.Add(new ReportRenderInstanceInfo(processId, expires));
|
||||||
|
|
||||||
// #if (DEBUG)
|
log.LogInformation($"AddProcess - there are currently {_baginstances.Count} instances in the collection");
|
||||||
// log.LogInformation($"DBG: RenderSlotAvailable::AddProcess, there are currently {_baginstances.Count} instances in the bag");
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void RemoveProcess(int processId, ILogger log)
|
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)
|
foreach (var i in _baginstances)
|
||||||
{
|
{
|
||||||
if (i.ReporterProcessId == processId)
|
if (i.ReporterProcessId == processId)
|
||||||
|
|||||||
Reference in New Issue
Block a user