Skip to content

Commit

Permalink
COLDBOX-1261 #resolve
Browse files Browse the repository at this point in the history
Migration of old tasks to new task syntax of task()
  • Loading branch information
lmajano committed Oct 31, 2023
1 parent 3e2cc18 commit 5eb8729
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 8 additions & 3 deletions system/cache/providers/CacheBoxProvider.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,17 @@ component
// Configure the reaping scheduled task
variables.cacheFactory
.getTaskScheduler()
.newSchedule( this, "reap" )
.newTask(
name : "cachebox-reap-#getName()#",
task : this,
method: "reap"
)
.inMinutes()
.delay( getConfiguration().reapFrequency ) // Don't start immediately, give it a breathing room
.spacedDelay( getConfiguration().reapFrequency ) // Runs again, after this spaced delay once each reap finalizes
.inMinutes()
.start();
variables.logger.info( "Reaping scheduled task started for #getName()# cache." );

variables.logger.info( "Reaping scheduled task started for (#getName()#) every (#getConfiguration().reapFrequency#) minutes" );

// startup message
variables.logger.info( "CacheBox Cache: #getName()# has been initialized successfully for operation" );
Expand Down
13 changes: 10 additions & 3 deletions system/logging/appenders/RollingFileAppender.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,22 @@ component accessors="true" extends="coldbox.system.logging.appenders.FileAppende

variables.logbox
.getTaskScheduler()
.newSchedule( this, "logRotation" )
.delay( 1 ) // Don't start immediately, give it a breathing room
.spacedDelay( 1 ) // Runs again, after this spaced delay once each reap finalizes
.newTask(
name : "file-appender-#getName()#-log-rotation",
task : this,
method: "logRotation"
)
.inMinutes()
.delay( 5 ) // Don't start immediately, give it a breathing room
.spacedDelay( 1 ) // Runs again, after this spaced delay once each reap finalizes
.start();

return this;
}

/**
* Rotate the log files
*/
function logRotation(){
try {
variables.fileRotator.checkRotation( this );
Expand Down

0 comments on commit 5eb8729

Please sign in to comment.