This commit is contained in:
@@ -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");
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Default timeout for each operation of report generation
|
//Default timeout for each operation of report generation
|
||||||
var WaitTimeout = new WaitForFunctionOptions() { Timeout = ServerBootConfig.REPORT_RENDERING_OPERATION_TIMEOUT };
|
var WaitTimeout = new WaitForFunctionOptions() { Timeout = ServerBootConfig.REPORT_RENDERING_OPERATION_TIMEOUT };
|
||||||
|
|
||||||
//includeWoItemDescendants?
|
//includeWoItemDescendants?
|
||||||
reportRequest.IncludeWoItemDescendants = report.IncludeWoItemDescendants;
|
reportRequest.IncludeWoItemDescendants = report.IncludeWoItemDescendants;
|
||||||
|
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -479,10 +488,10 @@ namespace AyaNova.Biz
|
|||||||
using (var page = await browser.NewPageAsync())
|
using (var page = await browser.NewPageAsync())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//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...");
|
||||||
@@ -629,7 +638,7 @@ namespace AyaNova.Biz
|
|||||||
//https://pptr.dev/#?product=Puppeteer&version=v5.3.0&show=api-pagepdfoptions
|
//https://pptr.dev/#?product=Puppeteer&version=v5.3.0&show=api-pagepdfoptions
|
||||||
log.LogDebug($"Resolving PDF Options from report settings");
|
log.LogDebug($"Resolving PDF Options from report settings");
|
||||||
var PdfOptions = new PdfOptions() { };
|
var PdfOptions = new PdfOptions() { };
|
||||||
|
|
||||||
PdfOptions.DisplayHeaderFooter = report.DisplayHeaderFooter;
|
PdfOptions.DisplayHeaderFooter = report.DisplayHeaderFooter;
|
||||||
if (report.DisplayHeaderFooter)
|
if (report.DisplayHeaderFooter)
|
||||||
{
|
{
|
||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user