Solved

CF10 Scheduler Less Than 1 Minute?

Posted on 2014-03-14
6
266 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
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 …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

10 Experts available now in Live!

Get 1:1 Help Now