Solved

CF10 Scheduler Less Than 1 Minute?

Posted on 2014-03-14
6
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…

738 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