Having some issues getting CB Scheduler to fire on what I thing should be the right days and times. I would like the task to fire on Weekdays between 9:30 AM and 4 PM which is NYSE open and close times. I have Lucee Server, ColdBox and Application all setup to use UTC. The tasks don’t fire during that time frame, nor do they fire during New York time frame. They seem to be going off much later. My laptop is Pacific time and even that time frame isn’t working either. Tasks do fire… just not as predicted.
Ideas on what I should check? Then check next?
/**
* Configure the ColdBox Scheduler
* https://coldbox.ortusbooks.com/digging-deeper/scheduled-tasks
*/
function configure(){
/**
* --------------------------------------------------------------------------
* Configuration Methods
* --------------------------------------------------------------------------
* From here you can set global configurations for the scheduler
* - setTimezone( ) : change the timezone for ALL tasks
* - setExecutor( executorObject ) : change the executor if needed
*/
/**
* --------------------------------------------------------------------------
* Register Scheduled Tasks
* --------------------------------------------------------------------------
* You register tasks with the task() method and get back a ColdBoxScheduledTask object
* that you can use to register your tasks configurations.
*/
setTimezone( "UTC" );
task( "Half Hourly Event Test" )
.call (function(){
view("some_handler/some_view");
cfmail( to = "user@domain.com", from = "user@domain.com", subject = "Half Hourly Event Test" ) { WriteOutput( "Your Half Hourly Event Test." ); }
})
.every(30, "minutes")
.onWeekdays()
.between( "13:30", "20:00" )
.onFailure( function( task, exception ){
writeDump( var='====> Half Hourly Event Test (#getThreadName()#)!! #exception.message# #exception.stacktrace.left( 500 )#', output="file.html", format="html" );
} );
}
Have it buy a share of NVDA daily while you’re at it.
Yes, actually. Make sure you have “Use time server” turned OFF in the Lucee settings. See this post:
Besides that, I don’t have any ideas. I’ve also struggled with scheduled tasks in coldbox, but I was never able to get to the bottom of what was going on.
Thanks! I’m taking your suggestion on the NTP checkbox in Lucee. I saw yet another post about the evils of DateConvert() and what UTC2Local and Local2UTC do to timestamps as strings. Datetime Timezone Handling in Lucee CFML - Andrew Dixon
I had a bunch of DateConvert() functions littered in my project. Thanks, from one Michael to another Michael!!
Why own $NVDA when you can trade it’s options? LOL! Lots of volume, etc. Markets change, so this may not be always true! It would be nice to get this Scheduled Task stuff worked out to take advantage of current market conditions.
Just one note, looking at your configure method in Scheduler.cfc: Since there is a global function setTimeZone you are setting that only for the current request and not for the scheduler itself. You would need to call `this.setTimezone‘ in order for it to operate on the AppScheduler, itself.