This commit is contained in:
2021-10-26 21:44:16 +00:00
parent 980788d332
commit 0b8e2f3739

View File

@@ -217,7 +217,7 @@ namespace AyaNova.Biz
await ValidateCanDelete(dbObject); await ValidateCanDelete(dbObject);
if (HasErrors) if (HasErrors)
return false; return false;
{ {
var IDList = await ct.Review.AsNoTracking().Where(x => x.AType == AyaType.Report && x.ObjectId == id).Select(x => x.Id).ToListAsync(); var IDList = await ct.Review.AsNoTracking().Where(x => x.AType == AyaType.Report && x.ObjectId == id).Select(x => x.Id).ToListAsync();
if (IDList.Count() > 0) if (IDList.Count() > 0)
{ {
@@ -317,7 +317,7 @@ namespace AyaNova.Biz
{ {
//Use Any command is efficient way to check existance, it doesn't return the record, just a true or false //Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
//NOTE: unlike other objects reports can have the same name as long as the type differs //NOTE: unlike other objects reports can have the same name as long as the type differs
if (await ct.Report.AnyAsync(z => z.Name == proposedObj.Name && z.AType==proposedObj.AType && z.Id != proposedObj.Id)) if (await ct.Report.AnyAsync(z => z.Name == proposedObj.Name && z.AType == proposedObj.AType && z.Id != proposedObj.Id))
{ {
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name"); AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
} }
@@ -459,7 +459,16 @@ namespace AyaNova.Biz
"--no-zygote" "--no-zygote"
] ]
*/ */
lo.Args = new string[] { "--disable-dev-shm-usage --no-sandbox --disable-gpu --single-process --no-zygote " }; //was using this for a long period of time
//lo.Args = new string[] { "--disable-dev-shm-usage --no-sandbox --disable-gpu --single-process --no-zygote " };
//however chrome may be problematic on linux, I'm seeing issues under load testing where it freezes out the droplet at 100% cpu and ram and it's
//chrome processes piling up all churning away so experimenting with resolutions
//this guy says single process should NOT be used
//https://github.com/puppeteer/puppeteer/issues/1825#issuecomment-792817748
//testing
lo.Args = new string[] { "--disable-dev-shm-usage --no-sandbox --disable-gpu --no-zygote " };
} }
else else
{ {
@@ -482,7 +491,7 @@ namespace AyaNova.Biz
//see catch block //see catch block
// var ChromiumProcessID = browser.Process.Id; var ChromiumProcessID = browser.Process.Id;
try try
{ {
@@ -592,11 +601,11 @@ namespace AyaNova.Biz
// #if (DEBUG) // #if (DEBUG)
// //view page contents // //view page contents
// var pagecontent = await page.GetContentAsync(); // var pagecontent = await page.GetContentAsync();
// #endif // #endif
//prePareData / preRender //prePareData / preRender
var ReportDataObject = $"{{ ayReportData:{ReportData}, ayReportMetaData:{reportMeta}, ayClientMetaData:{clientMeta}, ayServerMetaData:{serverMeta} }}"; var ReportDataObject = $"{{ ayReportData:{ReportData}, ayReportMetaData:{reportMeta}, ayClientMetaData:{clientMeta}, ayServerMetaData:{serverMeta} }}";
log.LogDebug($"Calling ayPreRender..."); log.LogDebug($"Calling ayPreRender...");
@@ -701,6 +710,15 @@ namespace AyaNova.Biz
//render to pdf and return //render to pdf and return
log.LogDebug($"Calling render page contents to PDF"); log.LogDebug($"Calling render page contents to PDF");
//============== TESTING =================
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();
}
//============================================
await page.PdfAsync(outputFullPath, PdfOptions);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE SUPPORTED, open bug: https://github.com/hardkoded/puppeteer-sharp/issues/1710 await page.PdfAsync(outputFullPath, PdfOptions);//###### TODO: SLOW NEEDS TIMEOUT HERE ONCE SUPPORTED, open bug: https://github.com/hardkoded/puppeteer-sharp/issues/1710
log.LogDebug($"Completed, returning results"); log.LogDebug($"Completed, returning results");