This commit is contained in:
2022-03-07 22:58:03 +00:00
parent 86725413fc
commit 5f01dda11a
3 changed files with 17 additions and 11 deletions

2
.vscode/launch.json vendored
View File

@@ -48,7 +48,7 @@
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata", "AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
"AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true", //"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
"AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1", //"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",

View File

@@ -211,8 +211,11 @@ namespace AyaNova.Biz
//BACKUP //BACKUP
await CoreJobBackup.DoWorkAsync(); await CoreJobBackup.DoWorkAsync();
if (!KeepOnWorking()) return; if (!KeepOnWorking()) return;
//NOTIFICATIONS
await CoreJobNotify.DoWorkAsync(); //NOTIFICATIONS
TaskUtil.Forget(Task.Run(() => CoreJobNotify.DoWorkAsync()));
// await CoreJobNotify.DoWorkAsync();
if (!KeepOnWorking()) return; if (!KeepOnWorking()) return;
await CoreNotificationSweeper.DoWorkAsync(); await CoreNotificationSweeper.DoWorkAsync();
if (!KeepOnWorking()) return; if (!KeepOnWorking()) return;

View File

@@ -403,7 +403,7 @@ namespace AyaNova.Biz
DeliveryLogItem.Error = $"No email address provided for smtp delivery; event: {ne}"; DeliveryLogItem.Error = $"No email address provided for smtp delivery; event: {ne}";
} }
else else
{ {
IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer; IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer;
if (!ServerGlobalOpsSettingsCache.Notify.SmtpDeliveryActive) if (!ServerGlobalOpsSettingsCache.Notify.SmtpDeliveryActive)
{ {
@@ -425,8 +425,8 @@ namespace AyaNova.Biz
//{"AType":34,"selectedRowIds":[355],"ReportId":9,"ClientMeta":{"UserName":"AyaNova SuperUser","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIxNjQ2NzgyNTc4IiwiaXNzIjoiYXlhbm92YS5jb20iLCJpZCI6IjEifQ.ad7Acq54JCRGitDWKDJFFnqKkidbdaKaFmj-RA_RG5E","DownloadToken":"NdoU8ca3LG4L39Tj2oi3UReeeM7FLevTgbgopTPhGbA","TimeZoneName":"America/Los_Angeles","LanguageName":"en-US","Hour12":true,"CurrencyName":"USD","DefaultLocale":"en","PDFDate":"3/3/22","PDFTime":"3:38 PM"}} //{"AType":34,"selectedRowIds":[355],"ReportId":9,"ClientMeta":{"UserName":"AyaNova SuperUser","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOiIxNjQ2NzgyNTc4IiwiaXNzIjoiYXlhbm92YS5jb20iLCJpZCI6IjEifQ.ad7Acq54JCRGitDWKDJFFnqKkidbdaKaFmj-RA_RG5E","DownloadToken":"NdoU8ca3LG4L39Tj2oi3UReeeM7FLevTgbgopTPhGbA","TimeZoneName":"America/Los_Angeles","LanguageName":"en-US","Hour12":true,"CurrencyName":"USD","DefaultLocale":"en","PDFDate":"3/3/22","PDFTime":"3:38 PM"}}
var reportRequest = new DataListReportRequest(); var reportRequest = new DataListReportRequest();
reportRequest.AType = ne.AyaType; reportRequest.AType = ne.AyaType;
reportRequest.ReportId = (long)subscription.LinkReportId; reportRequest.ReportId = (long)subscription.LinkReportId;
reportRequest.SelectedRowIds = new long[] { ne.ObjectId }; reportRequest.SelectedRowIds = new long[] { ne.ObjectId };
var jwt = Api.Controllers.AuthController.GenRpt(subTranslationId); var jwt = Api.Controllers.AuthController.GenRpt(subTranslationId);
@@ -434,7 +434,7 @@ namespace AyaNova.Biz
//this could be adjusted by culture if we allow user to set a culture but that's getting a bit into the weeds, likely the server default is fine //this could be adjusted by culture if we allow user to set a culture but that's getting a bit into the weeds, likely the server default is fine
var pdfDate = new DateTime().ToShortDateString(); var pdfDate = new DateTime().ToShortDateString();
var pdfTime = new DateTime().ToShortTimeString(); var pdfTime = new DateTime().ToShortTimeString();
var h12=subscription.Hour12?"true":"false"; var h12 = subscription.Hour12 ? "true" : "false";
reportRequest.ClientMeta = JToken.Parse($"{{'UserName':'-','Authorization':'Bearer {jwt}','TimeZoneName':'{subscription.TimeZoneOverride}','LanguageName':'{subscription.LanguageOverride}','Hour12':{h12},'CurrencyName':'{subscription.CurrencyName}','DefaultLocale':'en','PDFDate':'{pdfDate}','PDFTime':'{pdfTime}'}}"); reportRequest.ClientMeta = JToken.Parse($"{{'UserName':'-','Authorization':'Bearer {jwt}','TimeZoneName':'{subscription.TimeZoneOverride}','LanguageName':'{subscription.LanguageOverride}','Hour12':{h12},'CurrencyName':'{subscription.CurrencyName}','DefaultLocale':'en','PDFDate':'{pdfDate}','PDFTime':'{pdfTime}'}}");
//get port number //get port number
var match = System.Text.RegularExpressions.Regex.Match(ServerBootConfig.AYANOVA_USE_URLS, "[0-9]+"); var match = System.Text.RegularExpressions.Regex.Match(ServerBootConfig.AYANOVA_USE_URLS, "[0-9]+");
@@ -447,15 +447,15 @@ namespace AyaNova.Biz
else else
{ {
bool done = false; bool done = false;
bool timedOut = false; DateTime bailAfter = DateTime.Now.AddMinutes(ServerBootConfig.AYANOVA_REPORT_RENDERING_TIMEOUT);
//todo: need a timeout here that sets done as failed due to timeout while (!done && DateTime.Now < bailAfter)
while (!done && !timedOut)
{ {
var status = await JobsBiz.GetJobStatusAsync((Guid)jobid); var status = await JobsBiz.GetJobStatusAsync((Guid)jobid);
switch (status) switch (status)
{ {
case JobStatus.Completed: case JobStatus.Completed:
{ {
done = true;
//get job logs and parse file name from it //get job logs and parse file name from it
JobOperationsBiz jobopsbiz = new JobOperationsBiz(ct, 1, AuthorizationRoles.BizAdmin); JobOperationsBiz jobopsbiz = new JobOperationsBiz(ct, 1, AuthorizationRoles.BizAdmin);
List<JobOperationsLogInfoItem> log = await jobopsbiz.GetJobLogListAsync((Guid)jobid); List<JobOperationsLogInfoItem> log = await jobopsbiz.GetJobLogListAsync((Guid)jobid);
@@ -467,11 +467,14 @@ namespace AyaNova.Biz
break; break;
} }
case JobStatus.Failed: case JobStatus.Failed:
case JobStatus.Absent:
throw new ApplicationException($"REPORT RENDER JOB {jobid} started but failed"); throw new ApplicationException($"REPORT RENDER JOB {jobid} started but failed");
} }
} }
//throw new TimeoutException("JOB FAILED DUE TO REPORT RENDER TIMEOUT"); if (!done)
throw new TimeoutException("JOB FAILED DUE TO REPORT RENDER TIMEOUT");
} }
} }
else else