Solved

CF10 Scheduler Less Than 1 Minute?

Posted on 2014-03-14
6
276 Views
Last Modified: 2014-03-15
Is there a way to get a task to run again less than a minute later? I am using CF10 Enterprise.  I would basically like to create a task to kick off almost instantly after its created.  Is that possible?

At the end of my process, it checks to see if more is needed and will create a task to run in 1 minute.  This isn't awful, but if there are 120 more loops to go, that adds 120 more minutes to the overall process.  Is there a way to cut that time down or make it go immediately after created?


<cfschedule url="http://www.mysite.com/mycode.cfm" 
		action="update" 
		task="process files #TaskID#" 
		operation="httprequest"
		startdate="#DateFormat(Now(),'mm/dd/yyyy')#" 
		starttime="#TimeFormat(DateAdd('n', 1, Now()),'hh:mm:ss tt')#"
		interval="once">

Open in new window

0
Comment
Question by:theideabulb
  • 3
  • 2
6 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 39929692
If it's a one time task, just have the task call itself at the end of the .cfm script:

           <cfif ThereIsMoreWorkToDo>
                  <!--- kick off the task again.... --->
                  <cfschedule action="run" ...>
           </cfif>
0
 

Author Comment

by:theideabulb
ID: 39929790
So you are saying just to just do something like this?

<cfschedule url="http://www.mysite.com/mycode.cfm" 
		action="run" 
		interval="once">

Open in new window

0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39929850
I meant if it's a one time time task (ie process a batch of stuff, then end) you should define the task - once, with action="create|update".  Then inside your .cfm script, check if there's more work to do. If yes, call the task again by name:

       <cfschedule
            action = "run"
            task = "task name">

BTW, I haven't used it yet, but the scheduling engine changed in CF10. So the new engine "Quartz" may offer better options than were available in CF9 and prior:

http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSe61e35da8d31851899e53a51353e870493-8000.html
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 4

Expert Comment

by:Rodrigo Munera
ID: 39930423
So if you're running a loop, and the loop is creating scheduled tasks, it will create them instantly, and run one minute from now. So it doesn't matter if you create 10 or 10,000. they will all run one minute from now. (assuming the 10,000 tasks don't crash your server). In other words, your loop is not going to add a minute after the start time of the previous scheduled task, it adds the minute to the moment it was created. so assuming your loop runs in real time and the whole execution time takes less than a second, all your tasks will happen one minute afterwards.

I don't want to presume I understand what you're attempting, but if you're only going to run it once, and you don't want to wait for the code to run before you move to the next iteration of the loop, why don't you use something else like asynchronous cfml?

The real power of the scheduler is that you can write your code and have the code run at specific intervals for periods of time.

If you provide more information about what you're trying to do, we could point you to a better way of doing what you're attempting.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39931690
Yeah, good point. Threads can often help with splitting up big jobs and taking advantage of parallel execution, but it's not a cure all. All depends on the type of job, available threads and memory.  Agreed, more details about the process would help. ie Is this really a one time task - or is it a "polling" type task? ie One that checks every X minutes/seconds/etc... to see if there is new work to process?
0
 

Author Closing Comment

by:theideabulb
ID: 39931714
Actually for my case this worked just fine.  I created a one time task in the scheduler and point it to the url i need.  If there are more loops that need to be run, it executes that immediately.  It worked perfectly.  This will shave up to 30 minutes or more off some of the data tasks that i run
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question