Solved

CF10 Scheduler Less Than 1 Minute?

Posted on 2014-03-14
6
269 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now