This commit is contained in:
@@ -51,7 +51,7 @@ namespace AyaNova.Biz
|
||||
//LOCK DOWN SERVER
|
||||
apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
|
||||
apiServerState.SetClosed("BACKUP RUNNING");
|
||||
var jobstartmessage = $"Starting backup job {(OnDemand ? "manual / on demand" : "scheduled") } ";
|
||||
var jobstartmessage = $"LT:Backup LT:StartJob {(OnDemand ? "manual / on demand" : "scheduled") } ";
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, jobstartmessage);
|
||||
|
||||
DateTime dtStartBackup=DateTime.Now;
|
||||
@@ -63,7 +63,7 @@ namespace AyaNova.Biz
|
||||
//this is valid on windows
|
||||
//C:\data\code\PostgreSQLPortable_12.0\App\PgSQL\bin\pg_dump --dbname=postgresql://postgres:raven@127.0.0.1:5432/AyaNova -Fc > huge_new.backup
|
||||
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Data backup starting");
|
||||
// await JobsBiz.LogJobAsync(Guid.Empty, $"Data backup starting");
|
||||
Npgsql.NpgsqlConnectionStringBuilder PostgresConnectionString = new Npgsql.NpgsqlConnectionStringBuilder(ServerBootConfig.AYANOVA_DB_CONNECTION);
|
||||
var DBNameParameter = $"--dbname=postgresql://{PostgresConnectionString.Username}:{PostgresConnectionString.Password}@{PostgresConnectionString.Host}:{PostgresConnectionString.Port}/{PostgresConnectionString.Database}";
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace AyaNova.Biz
|
||||
//DO FILE BACKUP IF ATTACHMENTS BACKED UP
|
||||
if (ServerGlobalOpsSettingsCache.Backup.BackupAttachments)
|
||||
{
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Attachments backup starting");
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, $"LT:Backup LT:Attachments");
|
||||
FileUtil.BackupAttachments(DemandFileNamePrepend);
|
||||
var ms = "Backup of file attachments completed OK";
|
||||
log.LogDebug(ms);
|
||||
@@ -102,7 +102,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//PRUNE DATA BACKUP SETS NOT KEPT
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Pruning old backup sets");
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, $"LT:BackupDeleteOld");
|
||||
FileUtil.DatabaseBackupCleanUp(ServerGlobalOpsSettingsCache.Backup.BackupSetsToKeep);
|
||||
|
||||
//v.next - COPY TO ONLINE STORAGE
|
||||
@@ -114,7 +114,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, "Backup failed with errors:");
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, "LT:JobFailed");
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||
log.LogError(ex, "Backup failed");
|
||||
await NotifyEventProcessor.AddGeneralNotifyEvent(NotifyEventType.BackupStatus, "Backup failed","Backup", ex);
|
||||
@@ -127,7 +127,7 @@ namespace AyaNova.Biz
|
||||
ServerGlobalOpsSettingsCache.SetNextBackup();
|
||||
apiServerState.ResumePriorState();
|
||||
BackupIsRunning = false;
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Backup - fully complete, server re-opened");
|
||||
await JobsBiz.LogJobAsync(Guid.Empty, "LT:JobCompleted");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace AyaNova.Biz
|
||||
foreach (OpsJob j in jobs)
|
||||
{
|
||||
//OPSMETRIC
|
||||
await JobsBiz.LogJobAsync(j.GId, "Job took too long to run - setting to failed");
|
||||
await JobsBiz.LogJobAsync(j.GId, "LT:JobFailed LT:TimedOut");
|
||||
log.LogError($"Job found job stuck in running status and set to failed: deadline={dtRunningDeadline.ToString()}, jobId={j.GId.ToString()}, jobname={j.Name}, jobtype={j.JobType.ToString()}, jobObjectType={j.ObjectType.ToString()}, jobObjectId={j.ObjectId.ToString()}");
|
||||
await JobsBiz.UpdateJobStatusAsync(j.GId, JobStatus.Failed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user