Skip to content

Commit

Permalink
Merge branch 'development' of github.com:ColdBox/coldbox-platform int…
Browse files Browse the repository at this point in the history
…o development
  • Loading branch information
lmajano committed Oct 24, 2024
2 parents 64e4430 + 25b54a3 commit f6c3043
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
61 changes: 30 additions & 31 deletions system/async/tasks/Scheduler.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ component accessors="true" singleton {
/**
* The name of this scheduler
*/
property name = "name";
property name="name";

/**
* An ordered struct of all the tasks this scheduler manages
*/
property name = "tasks" type = "struct";
property name="tasks" type="struct";

/**
* The Scheduled Executor we are bound to
*/
property name = "executor";
property name="executor";

/**
* The default timezone to use for task executions
*/
property name = "timezone";
property name="timezone";

/**
* The default timeout to use when gracefully shutting down this scheduler. Default is 30 seconds.
*/
property
name = "shutdownTimeout"
type = "numeric"
default = "30";
name ="shutdownTimeout"
type ="numeric"
default="30";

/**
* Constructor
Expand All @@ -52,17 +52,17 @@ component accessors="true" singleton {
*/
function init( required name, required asyncManager ){
// Utility class
variables.util = new coldbox.system.core.util.Util();
variables.util = new coldbox.system.core.util.Util();
// Default shutdown timeout
variables.shutdownTimeout = 30;
// Name
variables.name = arguments.name;
variables.name = arguments.name;
// The async manager
variables.asyncManager = arguments.asyncManager;
variables.asyncManager = arguments.asyncManager;
// The collection of tasks we will run
variables.tasks = structNew( "ordered" );
variables.tasks = structNew( "ordered" );
// Default TimeZone to UTC for all tasks
variables.timezone = createObject( "java", "java.time.ZoneId" ).systemDefault();
variables.timezone = createObject( "java", "java.time.ZoneId" ).systemDefault();
// Build out the executor for this scheduler
createSchedulerExecutor();
// Bit that denotes if this scheduler has been started or not
Expand Down Expand Up @@ -136,16 +136,17 @@ component accessors="true" singleton {
* <p>
* If the task has an error scheduling, it will be marked as such.
*
* name, task, future, registeredAt, scheduledAt, disabled, error, errorMessage, stacktrace, inetHost, localIp
* }
*
* @task The task name or task object to startup
*
* @return The task record struct: {
* name, task, future, registeredAt, scheduledAt, disabled, error, errorMessage, stacktrace, inetHost, localIp
* }
*/
struct function startupTask( any task ){
var taskRecord = getTaskRecord(
isSimpleValue( arguments.task ) ? arguments.task: arguments.task.getName()
);
isSimpleValue( arguments.task ) ? arguments.task : arguments.task.getName()
);

// Verify we can start it up the task or not
if ( taskRecord.task.isDisabled() ) {
Expand Down Expand Up @@ -173,9 +174,7 @@ component accessors="true" singleton {
try {
taskRecord.future = taskRecord.task.start();
taskRecord.scheduledAt = now();
variables.asyncManager.out(
"√ Task (#taskRecord.task.getName()#) scheduled successfully."
);
variables.asyncManager.out( "√ Task (#taskRecord.task.getName()#) scheduled successfully." );
} catch ( any e ) {
variables.asyncManager.err(
"X Error scheduling task (#taskRecord.task.getName()#) => #e.message# #e.detail#"
Expand Down Expand Up @@ -307,7 +306,7 @@ component accessors="true" singleton {
return this;
}

/**
/**
* Register a new task in this scheduler but disable it immediately. This is useful
* when debugging tasks and have the easy ability to disable them.
*
Expand Down Expand Up @@ -345,27 +344,27 @@ component accessors="true" singleton {
// Create the task record.
variables.tasks[ arguments.name ] = {
// task name
"name": arguments.name,
"name" : arguments.name,
// task object
"task": oTask,
"task" : oTask,
// task scheduled future object
"future": "",
"future" : "",
// when it registers
"registeredAt": now(),
"registeredAt" : now(),
// when it's scheduled, else its empty
"scheduledAt": "",
"scheduledAt" : "",
// Tracks if the task has been disabled for startup purposes
"disabled": false,
"disabled" : false,
// If there is an error scheduling the task
"error": false,
"error" : false,
// Any error messages when scheduling
"errorMessage": "",
"errorMessage" : "",
// The exception stacktrace if something went wrong scheduling the task
"stacktrace": "",
"stacktrace" : "",
// Server Host
"inetHost": variables.util.discoverInetHost(),
"inetHost" : variables.util.discoverInetHost(),
// Server IP
"localIp": variables.util.getServerIp()
"localIp" : variables.util.getServerIp()
};

return oTask;
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/cache/lucee/LuceeUniqueTests.cfc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
component extends="coldbox.system.testing.BaseModelTest" skip="notLucee" {

boolean function notLucee(){
if( isBoxLang() || isAdobe() ){
if ( isBoxLang() || isAdobe() ) {
return true;
}
return false;
Expand Down

0 comments on commit f6c3043

Please sign in to comment.