This commit is contained in:
2020-07-21 22:01:54 +00:00
parent 336046b1d7
commit 3c650ba980
3 changed files with 17 additions and 8 deletions

View File

@@ -80,6 +80,8 @@ namespace AyaNova.Api.ControllerHelpers
if (loggableError)
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;
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)
context.ExceptionHandled = true;
response.WriteAsync(JsonConvert.SerializeObject(
new ApiErrorResponse(ApiErrorCode.API_SERVER_ERROR, "Server internal error", "See server log for details"),

View File

@@ -43,7 +43,7 @@ namespace AyaNova.Biz
}
}
AyaNova.Api.ControllerHelpers.ApiServerState apiServerState = null;
string BackupStatusNotification = string.Empty;
try
{
BackupIsRunning = true;
@@ -53,7 +53,8 @@ namespace AyaNova.Biz
apiServerState.SetClosed("BACKUP RUNNING");
var jobstartmessage = $"Starting backup job {(OnDemand ? "manual / on demand" : "scheduled") } ";
await JobsBiz.LogJobAsync(Guid.Empty, jobstartmessage);
BackupStatusNotification = jobstartmessage + "\n";
DateTime dtStartBackup=DateTime.Now;
log.LogDebug("Backup starting");
var DemandFileNamePrepend = OnDemand ? "manual-" : string.Empty;
//*************
@@ -80,7 +81,7 @@ namespace AyaNova.Biz
{
var ms = "Backup of database completed OK";
log.LogDebug(ms);
BackupStatusNotification += (ms + "\n");
}
else
{
@@ -96,8 +97,7 @@ namespace AyaNova.Biz
await JobsBiz.LogJobAsync(Guid.Empty, $"Attachments backup starting");
FileUtil.BackupAttachments(DemandFileNamePrepend);
var ms = "Backup of file attachments completed OK";
log.LogDebug(ms);
BackupStatusNotification += (ms + "\n");
log.LogDebug(ms);
}
@@ -109,6 +109,8 @@ namespace AyaNova.Biz
//***************
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)
{
@@ -126,7 +128,7 @@ namespace AyaNova.Biz
apiServerState.ResumePriorState();
BackupIsRunning = false;
await JobsBiz.LogJobAsync(Guid.Empty, $"Backup - fully complete, server re-opened");
await NotifyEventProcessor.AddGeneralNotifyEvent(NotifyEventType.BackupStatus, $"Backup completed server re-opened\nStatus:{BackupStatusNotification}");
}
}

View File

@@ -158,7 +158,12 @@ namespace AyaNova.Biz
{
log.LogTrace($"DeliverSMTP deliving notify event: {ne}");
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
}