This commit is contained in:
@@ -80,6 +80,8 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
if (loggableError)
|
if (loggableError)
|
||||||
log.LogError(context.Exception, "Error");
|
log.LogError(context.Exception, "Error");
|
||||||
|
|
||||||
|
//Notify ops notification issue
|
||||||
|
NotifyEventProcessor.AddOpsProblemEvent("Server API internal error, see log for more details", context.Exception).Forget();//.Wait();
|
||||||
|
|
||||||
HttpResponse response = context.HttpContext.Response;
|
HttpResponse response = context.HttpContext.Response;
|
||||||
response.StatusCode = (int)status;
|
response.StatusCode = (int)status;
|
||||||
@@ -87,7 +89,7 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
|
|
||||||
//This line is critical, without it the response is not proper and fails in various clients (postman, xunit tests with httpclient)
|
//This line is critical, without it the response is not proper and fails in various clients (postman, xunit tests with httpclient)
|
||||||
context.ExceptionHandled = true;
|
context.ExceptionHandled = true;
|
||||||
|
|
||||||
|
|
||||||
response.WriteAsync(JsonConvert.SerializeObject(
|
response.WriteAsync(JsonConvert.SerializeObject(
|
||||||
new ApiErrorResponse(ApiErrorCode.API_SERVER_ERROR, "Server internal error", "See server log for details"),
|
new ApiErrorResponse(ApiErrorCode.API_SERVER_ERROR, "Server internal error", "See server log for details"),
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = null;
|
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = null;
|
||||||
string BackupStatusNotification = string.Empty;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
BackupIsRunning = true;
|
BackupIsRunning = true;
|
||||||
@@ -53,7 +53,8 @@ namespace AyaNova.Biz
|
|||||||
apiServerState.SetClosed("BACKUP RUNNING");
|
apiServerState.SetClosed("BACKUP RUNNING");
|
||||||
var jobstartmessage = $"Starting backup job {(OnDemand ? "manual / on demand" : "scheduled") } ";
|
var jobstartmessage = $"Starting backup job {(OnDemand ? "manual / on demand" : "scheduled") } ";
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, jobstartmessage);
|
await JobsBiz.LogJobAsync(Guid.Empty, jobstartmessage);
|
||||||
BackupStatusNotification = jobstartmessage + "\n";
|
|
||||||
|
DateTime dtStartBackup=DateTime.Now;
|
||||||
log.LogDebug("Backup starting");
|
log.LogDebug("Backup starting");
|
||||||
var DemandFileNamePrepend = OnDemand ? "manual-" : string.Empty;
|
var DemandFileNamePrepend = OnDemand ? "manual-" : string.Empty;
|
||||||
//*************
|
//*************
|
||||||
@@ -80,7 +81,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
var ms = "Backup of database completed OK";
|
var ms = "Backup of database completed OK";
|
||||||
log.LogDebug(ms);
|
log.LogDebug(ms);
|
||||||
BackupStatusNotification += (ms + "\n");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -96,8 +97,7 @@ namespace AyaNova.Biz
|
|||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Attachments backup starting");
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Attachments backup starting");
|
||||||
FileUtil.BackupAttachments(DemandFileNamePrepend);
|
FileUtil.BackupAttachments(DemandFileNamePrepend);
|
||||||
var ms = "Backup of file attachments completed OK";
|
var ms = "Backup of file attachments completed OK";
|
||||||
log.LogDebug(ms);
|
log.LogDebug(ms);
|
||||||
BackupStatusNotification += (ms + "\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +109,8 @@ namespace AyaNova.Biz
|
|||||||
//***************
|
//***************
|
||||||
|
|
||||||
log.LogDebug("Backup completed");
|
log.LogDebug("Backup completed");
|
||||||
|
var duration=DateTime.Now - dtStartBackup;
|
||||||
|
await NotifyEventProcessor.AddGeneralNotifyEvent(NotifyEventType.BackupStatus, $"Backup completed {(OnDemand ? "manual / on demand" : "scheduled")} duration: {duration.ToString()} server re-opened");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -126,7 +128,7 @@ namespace AyaNova.Biz
|
|||||||
apiServerState.ResumePriorState();
|
apiServerState.ResumePriorState();
|
||||||
BackupIsRunning = false;
|
BackupIsRunning = false;
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Backup - fully complete, server re-opened");
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Backup - fully complete, server re-opened");
|
||||||
await NotifyEventProcessor.AddGeneralNotifyEvent(NotifyEventType.BackupStatus, $"Backup completed server re-opened\nStatus:{BackupStatusNotification}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,12 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
log.LogTrace($"DeliverSMTP deliving notify event: {ne}");
|
log.LogTrace($"DeliverSMTP deliving notify event: {ne}");
|
||||||
throw new System.NotImplementedException("DeliverSMTP: NOT IMPLEMENTED YET");
|
throw new System.NotImplementedException("DeliverSMTP: NOT IMPLEMENTED YET");
|
||||||
|
//todo: //Open question: what to do with failed deliveries?
|
||||||
|
//we dont' want them piling up but we don't want to just dump them do we?
|
||||||
|
//it should be only mail ones that fail, not app ones, there's no way for an app delivery to fail as it's just put in a table
|
||||||
|
//### PLAN if it's an smtp delivery that fails and it's to someone who can be delivered in app then it should send an inapp notification of
|
||||||
|
//delivery failure and still delete the smtp delivery
|
||||||
|
//If it's not possible to notify the person via in app of the failed smtp then perhaps it notifies OPS personnel and biz admin personnel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user