This commit is contained in:
@@ -148,7 +148,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
OpsJob j = new OpsJob();
|
OpsJob j = new OpsJob();
|
||||||
j.Name = "TestJob";
|
j.Name = "TestJob";
|
||||||
j.JobType = JobType.TestJob;
|
j.JobType = JobType.TestJob;
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, $"{j.JobType} {j.Name}"), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, $"{j.JobType} {j.Name}"), ct);
|
||||||
return Accepted(new { JobId = j.GId });//202 accepted
|
return Accepted(new { JobId = j.GId });//202 accepted
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
var res = await Search.GetInfoAsync(ct, UserTranslationIdFromContext.Id(HttpContext.Items),
|
var res = await Search.GetInfoAsync(UserTranslationIdFromContext.Id(HttpContext.Items),
|
||||||
UserRolesFromContext.Roles(HttpContext.Items), UserIdFromContext.Id(HttpContext.Items), phrase, max, ayaType, id);
|
UserRolesFromContext.Roles(HttpContext.Items), UserIdFromContext.Id(HttpContext.Items), phrase, max, ayaType, id);
|
||||||
|
|
||||||
return Ok(ApiOkResponse.Response(res));
|
return Ok(ApiOkResponse.Response(res));
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.SubType = JobSubType.TagAdd;
|
j.SubType = JobSubType.TagAdd;
|
||||||
j.Exclusive = false;
|
j.Exclusive = false;
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
||||||
return Accepted(new { JobId = j.GId });
|
return Accepted(new { JobId = j.GId });
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.SubType = JobSubType.TagAddAny;
|
j.SubType = JobSubType.TagAddAny;
|
||||||
j.Exclusive = false;
|
j.Exclusive = false;
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
||||||
return Accepted(new { JobId = j.GId });
|
return Accepted(new { JobId = j.GId });
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
var JobName = $"Bulk operation: Remove tag \"{tag}\" from {ayaType} ({idList.Count} specified)";
|
var JobName = $"Bulk operation: Remove tag \"{tag}\" from {ayaType} ({idList.Count} specified)";
|
||||||
JObject o = JObject.FromObject(new
|
JObject o = JObject.FromObject(new
|
||||||
{
|
{
|
||||||
idList = idList,
|
idList = idList,
|
||||||
tag = tag
|
tag = tag
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.SubType = JobSubType.TagRemove;
|
j.SubType = JobSubType.TagRemove;
|
||||||
j.Exclusive = false;
|
j.Exclusive = false;
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
||||||
return Accepted(new { JobId = j.GId });
|
return Accepted(new { JobId = j.GId });
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.JobType = JobType.BulkCoreBizObjectOperation;
|
j.JobType = JobType.BulkCoreBizObjectOperation;
|
||||||
j.Exclusive = false;
|
j.Exclusive = false;
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
||||||
return Accepted(new { JobId = j.GId });
|
return Accepted(new { JobId = j.GId });
|
||||||
}
|
}
|
||||||
@@ -287,7 +287,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.SubType = JobSubType.TagReplace;
|
j.SubType = JobSubType.TagReplace;
|
||||||
j.Exclusive = false;
|
j.Exclusive = false;
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
||||||
return Accepted(new { JobId = j.GId });
|
return Accepted(new { JobId = j.GId });
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.SubType = JobSubType.TagReplaceAny;
|
j.SubType = JobSubType.TagReplaceAny;
|
||||||
j.Exclusive = false;
|
j.Exclusive = false;
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, JobName), ct);
|
||||||
return Accepted(new { JobId = j.GId });
|
return Accepted(new { JobId = j.GId });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
j.JobType = JobType.SeedTestData;
|
j.JobType = JobType.SeedTestData;
|
||||||
j.Exclusive = true;//don't run other jobs, this will erase the db
|
j.Exclusive = true;//don't run other jobs, this will erase the db
|
||||||
j.JobInfo = o.ToString();
|
j.JobInfo = o.ToString();
|
||||||
await JobsBiz.AddJobAsync(j, ct);
|
await JobsBiz.AddJobAsync(j);
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.TrialSeeder, AyaEvent.Created, size), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.TrialSeeder, AyaEvent.Created, size), ct);
|
||||||
|
|||||||
@@ -128,11 +128,11 @@ namespace AyaNova.Biz
|
|||||||
private async Task ProcessTestJobAsync(OpsJob job)
|
private async Task ProcessTestJobAsync(OpsJob job)
|
||||||
{
|
{
|
||||||
var sleepTime = 30 * 1000;
|
var sleepTime = 30 * 1000;
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running);
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"ProcessTestJob started, sleeping for {sleepTime} seconds...", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"ProcessTestJob started, sleeping for {sleepTime} seconds...");
|
||||||
await Task.Delay(sleepTime);
|
await Task.Delay(sleepTime);
|
||||||
await JobsBiz.LogJobAsync(job.GId, "ProcessTestJob done sleeping setting job to finished", ct);
|
await JobsBiz.LogJobAsync(job.GId, "ProcessTestJob done sleeping setting job to finished");
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace AyaNova.Biz
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ayObj"></param>
|
/// <param name="ayObj"></param>
|
||||||
///
|
///
|
||||||
internal static async Task DeleteJobsForObjectAsync(AyaTypeId ayObj, AyContext ct)
|
internal static async Task DeleteJobsForObjectAsync(AyaTypeId ayObj)
|
||||||
{
|
{
|
||||||
//Get a list of all jobid's for the object passed in
|
//Get a list of all jobid's for the object passed in
|
||||||
List<OpsJob> jobsForObject = await GetJobsForObjectAsync(ayObj);
|
List<OpsJob> jobsForObject = await GetJobsForObjectAsync(ayObj);
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ namespace AyaNova.Biz
|
|||||||
//NOTE: If this code throws an exception the caller will automatically set the job to failed and log the exeption so
|
//NOTE: If this code throws an exception the caller will automatically set the job to failed and log the exeption so
|
||||||
//basically any error condition during job processing should throw up an exception if it can't be handled
|
//basically any error condition during job processing should throw up an exception if it can't be handled
|
||||||
|
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running);
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Starting...", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Starting...");
|
||||||
JObject jobData = JObject.Parse(job.JobInfo);
|
JObject jobData = JObject.Parse(job.JobInfo);
|
||||||
var seedLevel = (Seeder.SeedLevel)jobData["seedLevel"].Value<int>();
|
var seedLevel = (Seeder.SeedLevel)jobData["seedLevel"].Value<int>();
|
||||||
var timeZoneOffset = jobData["timeZoneOffset"].Value<decimal>();
|
var timeZoneOffset = jobData["timeZoneOffset"].Value<decimal>();
|
||||||
await Seeder.SeedDatabaseAsync(seedLevel, job.GId, timeZoneOffset);
|
await Seeder.SeedDatabaseAsync(seedLevel, job.GId, timeZoneOffset);
|
||||||
await JobsBiz.LogJobAsync(job.GId, "Finished.", ct);
|
await JobsBiz.LogJobAsync(job.GId, "Finished.");
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -584,8 +584,8 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
private async Task ProcessBulkJobAsync(OpsJob job)
|
private async Task ProcessBulkJobAsync(OpsJob job)
|
||||||
{
|
{
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running);
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} started...", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} started...");
|
||||||
List<long> idList = new List<long>();
|
List<long> idList = new List<long>();
|
||||||
long ChangedObjectCount = 0;
|
long ChangedObjectCount = 0;
|
||||||
JObject jobData = JObject.Parse(job.JobInfo);
|
JObject jobData = JObject.Parse(job.JobInfo);
|
||||||
@@ -621,7 +621,7 @@ namespace AyaNova.Biz
|
|||||||
CopyObject.Copy(o, u, "Id, Salt, CurrentAuthToken, DlKey, DlKeyExpire");
|
CopyObject.Copy(o, u, "Id, Salt, CurrentAuthToken, DlKey, DlKeyExpire");
|
||||||
u = await PutAsync(u);
|
u = await PutAsync(u);
|
||||||
if (u == null)
|
if (u == null)
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}: {GetErrorsAsString()}", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}: {GetErrorsAsString()}");
|
||||||
else
|
else
|
||||||
ChangedObjectCount++;
|
ChangedObjectCount++;
|
||||||
}
|
}
|
||||||
@@ -630,12 +630,12 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}");
|
||||||
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex), ct);
|
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} changed {ChangedObjectCount} of {idList.Count}", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} changed {ChangedObjectCount} of {idList.Count}");
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
private async Task ProcessBulkJobAsync(OpsJob job)
|
private async Task ProcessBulkJobAsync(OpsJob job)
|
||||||
{
|
{
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running);
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} started...", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} started...");
|
||||||
List<long> idList = new List<long>();
|
List<long> idList = new List<long>();
|
||||||
long ProcessedObjectCount = 0;
|
long ProcessedObjectCount = 0;
|
||||||
JObject jobData = JObject.Parse(job.JobInfo);
|
JObject jobData = JObject.Parse(job.JobInfo);
|
||||||
@@ -336,7 +336,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
o = await PutAsync(o);
|
o = await PutAsync(o);
|
||||||
if (o == null)
|
if (o == null)
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}: {GetErrorsAsString()}", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}: {GetErrorsAsString()}");
|
||||||
else
|
else
|
||||||
ProcessedObjectCount++;
|
ProcessedObjectCount++;
|
||||||
}
|
}
|
||||||
@@ -345,12 +345,12 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}");
|
||||||
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex), ct);
|
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} processed {ProcessedObjectCount} of {idList.Count}", ct);
|
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} processed {ProcessedObjectCount} of {idList.Count}");
|
||||||
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed, ct);
|
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
public static async Task DoWorkAsync(AyContext ct, bool OnDemand = false)
|
public static async Task DoWorkAsync(bool OnDemand = false)
|
||||||
{
|
{
|
||||||
if (BackupIsRunning) return;
|
if (BackupIsRunning) return;
|
||||||
if (!OnDemand)
|
if (!OnDemand)
|
||||||
@@ -41,7 +41,7 @@ namespace AyaNova.Biz
|
|||||||
//LOCK DOWN SERVER
|
//LOCK DOWN SERVER
|
||||||
apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
|
apiServerState = (AyaNova.Api.ControllerHelpers.ApiServerState)ServiceProviderProvider.Provider.GetService(typeof(AyaNova.Api.ControllerHelpers.ApiServerState));
|
||||||
apiServerState.SetClosed("BACKUP RUNNING");
|
apiServerState.SetClosed("BACKUP RUNNING");
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Starting backup job {(OnDemand ? "manual / on demand" : "scheduled") } ", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Starting backup job {(OnDemand ? "manual / on demand" : "scheduled") } ");
|
||||||
log.LogDebug("Backup starting");
|
log.LogDebug("Backup starting");
|
||||||
var DemandFileNamePrepend=OnDemand?"manual-":string.Empty;
|
var DemandFileNamePrepend=OnDemand?"manual-":string.Empty;
|
||||||
//*************
|
//*************
|
||||||
@@ -50,7 +50,7 @@ namespace AyaNova.Biz
|
|||||||
//this is valid on windows
|
//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
|
//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", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Data backup starting");
|
||||||
Npgsql.NpgsqlConnectionStringBuilder PostgresConnectionString = new Npgsql.NpgsqlConnectionStringBuilder(ServerBootConfig.AYANOVA_DB_CONNECTION);
|
Npgsql.NpgsqlConnectionStringBuilder PostgresConnectionString = new Npgsql.NpgsqlConnectionStringBuilder(ServerBootConfig.AYANOVA_DB_CONNECTION);
|
||||||
var DBNameParameter = $"--dbname=postgresql://{PostgresConnectionString.Username}:{PostgresConnectionString.Password}@{PostgresConnectionString.Host}:{PostgresConnectionString.Port}/{PostgresConnectionString.Database}";
|
var DBNameParameter = $"--dbname=postgresql://{PostgresConnectionString.Username}:{PostgresConnectionString.Password}@{PostgresConnectionString.Host}:{PostgresConnectionString.Port}/{PostgresConnectionString.Database}";
|
||||||
|
|
||||||
@@ -71,19 +71,19 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Error during data backup \"{Result}\"", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Error during data backup \"{Result}\"");
|
||||||
log.LogError($"BACKUP ERROR: {Result}");
|
log.LogError($"BACKUP ERROR: {Result}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//DO FILE BACKUP IF ATTACHMENTS BACKED UP
|
//DO FILE BACKUP IF ATTACHMENTS BACKED UP
|
||||||
if (ServerGlobalOpsSettingsCache.Backup.BackupAttachments)
|
if (ServerGlobalOpsSettingsCache.Backup.BackupAttachments)
|
||||||
{
|
{
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Attachments backup starting", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Attachments backup starting");
|
||||||
FileUtil.BackupAttachments(DemandFileNamePrepend);
|
FileUtil.BackupAttachments(DemandFileNamePrepend);
|
||||||
}
|
}
|
||||||
|
|
||||||
//PRUNE DATA BACKUP SETS NOT KEPT
|
//PRUNE DATA BACKUP SETS NOT KEPT
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Pruning old backup sets", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Pruning old backup sets");
|
||||||
FileUtil.DatabaseBackupCleanUp(ServerGlobalOpsSettingsCache.Backup.BackupSetsToKeep);
|
FileUtil.DatabaseBackupCleanUp(ServerGlobalOpsSettingsCache.Backup.BackupSetsToKeep);
|
||||||
|
|
||||||
//v.next - COPY TO ONLINE STORAGE
|
//v.next - COPY TO ONLINE STORAGE
|
||||||
@@ -92,8 +92,8 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, "Backup failed with errors:", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, "Backup failed with errors:");
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, ExceptionUtil.ExtractAllExceptionMessages(ex), ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||||
log.LogError(ex, "Backup failed");
|
log.LogError(ex, "Backup failed");
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ namespace AyaNova.Biz
|
|||||||
ServerGlobalOpsSettingsCache.SetNextBackup();
|
ServerGlobalOpsSettingsCache.SetNextBackup();
|
||||||
apiServerState.ResumePriorState();
|
apiServerState.ResumePriorState();
|
||||||
BackupIsRunning = false;
|
BackupIsRunning = false;
|
||||||
await JobsBiz.LogJobAsync(Guid.Empty, $"Backup - fully complete, server re-opened", ct);
|
await JobsBiz.LogJobAsync(Guid.Empty, $"Backup - fully complete, server re-opened");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ namespace AyaNova.Biz
|
|||||||
foreach (OpsJob j in jobs)
|
foreach (OpsJob j in jobs)
|
||||||
{
|
{
|
||||||
//OPSMETRIC
|
//OPSMETRIC
|
||||||
await JobsBiz.LogJobAsync(j.GId, "Job took too long to run - setting to failed", ct);
|
await JobsBiz.LogJobAsync(j.GId, "Job took too long to run - setting to failed");
|
||||||
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()}");
|
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, ct);
|
await JobsBiz.UpdateJobStatusAsync(j.GId, JobStatus.Failed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user