House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

calling a template but not waiting for it to finish running

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Smith
03/09/2010 02:23 PM

I have some code that I would like to run with each page request, but it might take a while and I'd like to not have to wait for it to finish running. So basically, I'd like to initiate a template in Application.cfm, without a cfinclude.  Is this possible? This will be on crystaltech, a shared hosting enviroment, so please keep in mind the tag restrictions.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peter Boughton
03/09/2010 02:25 PM

Read up on "threading", which CF implements with the cfthread tag.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Smith
03/09/2010 02:27 PM

cool, I'll check it out. > > Read up on "threading", which CF implements with the cfthread tag.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Wil Genovese
03/09/2010 02:36 PM

If you are using CF8 or CF9 - I'd looked into what can be done with cfthread. And I would not put that into the Application.cfm  (should be using Application.cfc anyways - you can do more with it), that kind of code should be executed from your controller for every page request.  Spawn the thread at the beginning of the request then gather the results in at the end of the request. Another way is to use AJAX. Wil ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
03/09/2010 02:49 PM

On 3/9/2010 11:36 AM, Wil Genovese wrote: > Another way is to use AJAX. > > Wil >     Yet another way, if you want to go old school - before the days of <cfthread...> you can also do a <cfhttp...> with a timeout value of 0. Another new school way that may be relevant, is ColdFusion gateways.   Really depends on what one is actually trying to accomplish.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Jon Sala
03/09/2010 02:58 PM

Yes, find it clean to set up a gateway instance and then call SendGatewayMessage() for background processing. Not sure if Matthew's Crystaltech will let him access that. On 3/9/2010 11:36 AM, Wil Genovese wrote: > Another way is to use AJAX. > > Wil > Yet another way, if you want to go old school - before the days of <cfthread...> you can also do a <cfhttp...> with a timeout value of 0. Another new school way that may be relevant, is ColdFusion gateways. Really depends on what one is actually trying to accomplish.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matthew Smith
03/09/2010 04:27 PM

>you can also do a <cfhttp...> with a timeout value of 0. Much easier.  Any drawbacks?  I don't need any values back from the request, I just need it to run. ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ian Skinner
03/09/2010 05:30 PM

On 3/9/2010 1:20 PM, Matthew Smith wrote: ----- Excess quoted text cut - see Original Post for more ----- Other than it is much more limited in capabilities then the modern <cfthread...> equivalent, if it meets your needs within its limitations the is nothing wrong with the technique.  Just realize that there is *zero* way to know what the results of the abandon request was, so if it is throwing errors or not doing what it is supposed to be doing, it is not going to be telling you of its problems.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bobby
03/09/2010 02:39 PM

Check out cfthread. I have some code that I would like to run with each page request, but it might take a while and I'd like to not have to wait for it to finish running. So basically, I'd like to initiate a template in Application.cfm, without a cfinclude.  Is this possible? This will be on crystaltech, a shared hosting enviroment, so please keep in mind the tag restrictions.


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

July 31, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
         1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31