This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -51,7 +51,7 @@
|
|||||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_SERVER_TEST_MODE":"true",
|
"AYANOVA_SERVER_TEST_MODE":"false",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH":"C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH":"C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace AyaNova.Api.ControllerHelpers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return _reason;
|
return $"\"{_reason}\"";
|
||||||
// if (_currentState == ServerState.Closed)
|
// if (_currentState == ServerState.Closed)
|
||||||
// return $"{ AyaNova.Biz.TranslationBiz.GetDefaultTranslationAsync("ErrorAPI2000").Result}\r\n{_reason}";
|
// return $"{ AyaNova.Biz.TranslationBiz.GetDefaultTranslationAsync("ErrorAPI2000").Result}\r\n{_reason}";
|
||||||
// else //opsonly
|
// else //opsonly
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <returns>Job Id</returns>
|
/// <returns>Job Id</returns>
|
||||||
[HttpPost("backup-now")]
|
[HttpPost("backup-now")]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<IActionResult> PostServerState()
|
public async Task<IActionResult> PostBackupNow()
|
||||||
{
|
{
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
|
log.LogDebug($"Adding new job:{newJob.ToString()}");
|
||||||
|
await LogJobAsync(newJob.GId, $"Adding new job \"{newJob.Name}\" to queue");
|
||||||
await ct.OpsJob.AddAsync(newJob);
|
await ct.OpsJob.AddAsync(newJob);
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
@@ -83,6 +85,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
log.LogDebug($"RemoveJobAndLogs for job id:{jobIdToBeDeleted}");
|
||||||
//delete logs
|
//delete logs
|
||||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aopsjoblog where jobid = {jobIdToBeDeleted}");
|
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aopsjoblog where jobid = {jobIdToBeDeleted}");
|
||||||
//delete the job
|
//delete the job
|
||||||
@@ -169,6 +172,7 @@ namespace AyaNova.Biz
|
|||||||
ActivelyProcessing = true;
|
ActivelyProcessing = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
log.LogDebug("Processing critical internal jobs");
|
||||||
//### Critical internal jobs, these run even if there is a license related serverlock
|
//### Critical internal jobs, these run even if there is a license related serverlock
|
||||||
//LICENSE FETCH
|
//LICENSE FETCH
|
||||||
await CoreJobLicense.DoWorkAsync();
|
await CoreJobLicense.DoWorkAsync();
|
||||||
@@ -193,6 +197,7 @@ namespace AyaNova.Biz
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
log.LogDebug("Processing semi-critical internal jobs");
|
||||||
|
|
||||||
//BACKUP
|
//BACKUP
|
||||||
await CoreJobBackup.DoWorkAsync();
|
await CoreJobBackup.DoWorkAsync();
|
||||||
@@ -204,8 +209,9 @@ namespace AyaNova.Biz
|
|||||||
//JOB SWEEPER / AND USER COUNT CHECK
|
//JOB SWEEPER / AND USER COUNT CHECK
|
||||||
await CoreJobSweeper.DoWorkAsync();
|
await CoreJobSweeper.DoWorkAsync();
|
||||||
|
|
||||||
//### API Open only jobs
|
|
||||||
if (!serverState.IsOpen) return;
|
|
||||||
|
log.LogDebug("Processing exclusive dynamic jobs");
|
||||||
|
|
||||||
//BIZOBJECT DYNAMIC JOBS
|
//BIZOBJECT DYNAMIC JOBS
|
||||||
//get a list of exclusive jobs that are due to happen
|
//get a list of exclusive jobs that are due to happen
|
||||||
@@ -226,10 +232,17 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//### API Open only jobs
|
||||||
|
if (!serverState.IsOpen)
|
||||||
|
{
|
||||||
|
log.LogDebug("Server state is NOT open, skipping processing non-exclusive dynamic jobs");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
//NON-EXCLUSIVE JOBS
|
//NON-EXCLUSIVE JOBS
|
||||||
//
|
//
|
||||||
|
log.LogDebug("Processing non-exclusive dynamic jobs");
|
||||||
|
|
||||||
//These fire and forget but use a technique to bubble up exceptions anyway
|
//These fire and forget but use a technique to bubble up exceptions anyway
|
||||||
List<OpsJob> sharedJobs = await GetReadyJobsNotExlusiveOnlyAsync();
|
List<OpsJob> sharedJobs = await GetReadyJobsNotExlusiveOnlyAsync();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using AyaNova.Biz;
|
using AyaNova.Biz;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace AyaNova.Models
|
namespace AyaNova.Models
|
||||||
{
|
{
|
||||||
@@ -55,6 +56,12 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user