Solved

CF10 Scheduler Less Than 1 Minute?

Posted on 2014-03-14
6
273 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Query help 4 80
segregating a list into two lists 4 71
Coldfusion- Create and save form elements in Database 7 72
Scrolling feed with Coldfusion 3 41
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

776 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