This commit is contained in:
@@ -424,6 +424,8 @@ namespace AyaNova.Biz
|
||||
using (var browser = await Puppeteer.LaunchAsync(lo))
|
||||
using (var page = await browser.NewPageAsync())
|
||||
{
|
||||
//see catch block
|
||||
var ChromiumProcessID = browser.Process.Id;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -658,9 +660,14 @@ namespace AyaNova.Biz
|
||||
//(it might also mean other things wrong with template)
|
||||
if (PageLog.Length > 0)
|
||||
{
|
||||
log.LogInformation($"Error rendering report \"{report.Name}\": ");
|
||||
log.LogInformation($"Exception caught while rendering report \"{report.Name}\", report Page console log:");
|
||||
log.LogInformation(PageLog.ToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// var v=await page.GetContentAsync();
|
||||
throw;
|
||||
}
|
||||
@@ -668,6 +675,14 @@ namespace AyaNova.Biz
|
||||
{
|
||||
log.LogDebug($"Closing browser");
|
||||
await browser.CloseAsync();
|
||||
|
||||
//this probably isn't absolutely necessary but insurance
|
||||
var process = System.Diagnostics.Process.GetProcessById(ChromiumProcessID);
|
||||
if (ChromiumProcessID > 0 && process?.HasExited == false)
|
||||
{
|
||||
log.LogError($"Error during render, Chromium process (pid {ChromiumProcessID}) still active, forcing it to stop now");
|
||||
process.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user