Re: Wait for File to Get Written

2012-05-30 Thread Judah McAuley

You could also use cfthread. Spawn the execution off into another
thread, then use the cfthread join action to make current processing
wait until the child thread is finished and rejoined. Put your logic
to check for file existence in the child thread where the execution of
the external app is. Then you have a timeout on the join so that it
won't wait around forever. Might be a bit cleaner separation.

Judah

On Wed, May 30, 2012 at 9:55 AM, Mary Jo Sminkey  wrote:
>
>>maybe use cfdirectory and look at 'dateLastModified' to wait for it to be
>>2~5 old (so you know it has finished writing to it)
>
> Well, not sure that has any benefit by itself versus just checking if the 
> file exists.
>
>
>>I would make a retry loop, say 5 times with a sleep in between
>>and break out if file found
>
> Okay, yeah this is more the piece I was looking for, a way to find the file 
> quickly if it is there, while also ensuring that the page won't hang waiting 
> for it if it doesn't complete. Yeah, this should work nicely, thanks!
>
> Mary Jo
>
>
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351365
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Wait for File to Get Written

2012-05-30 Thread Mary Jo Sminkey

> If you just add a timeout to your cfexecute, CF will wait and 
> continue
> when the legacy program is ready.

Cool, yeah that looks like a good addition to this particular process. 


Mary Jo 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351364
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Wait for File to Get Written

2012-05-30 Thread Mary Jo Sminkey

>maybe use cfdirectory and look at 'dateLastModified' to wait for it to be
>2~5 old (so you know it has finished writing to it)

Well, not sure that has any benefit by itself versus just checking if the file 
exists. 


>I would make a retry loop, say 5 times with a sleep in between
>and break out if file found

Okay, yeah this is more the piece I was looking for, a way to find the file 
quickly if it is there, while also ensuring that the page won't hang waiting 
for it if it doesn't complete. Yeah, this should work nicely, thanks!

Mary Jo




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351363
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Wait for File to Get Written

2012-05-30 Thread Jochem van Dieten

On Wed, May 30, 2012 at 1:03 AM, Mary Jo Sminkey wrote:
> Basically I have situations where I need to wait for ColdFusion to finish 
> creating a file before displaying it. The legacy code I'm working with using 
> a cfexecute to run an executable file, and it uses this code snippet:
> 
> 

If you just add a timeout to your cfexecute, CF will wait and continue
when the legacy program is ready.

Jochem

-- 
Jochem van Dieten
http://jochem.vandieten.net/

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351361
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Wait for File to Get Written

2012-05-29 Thread AJ Mercer

maybe use cfdirectory and look at 'dateLastModified' to wait for it to be
2~5 old (so you know it has finished writing to it)

I would make a retry loop, say 5 times with a sleep in between
and break out if file found

On 30 May 2012 07:03, Mary Jo Sminkey  wrote:

>
> I've run into this a number of times the last few months and couldn't find
> anything in the archives that really seemed to address it. It's a common
> enough issue that I'm sure people have dealt with it, and I'm curious what
> solutions you might use.
>
> Basically I have situations where I need to wait for ColdFusion to finish
> creating a file before displaying it. The legacy code I'm working with
> using a cfexecute to run an executable file, and it uses this code snippet:
>
> 
> 
>
> So basically it loops until it finds the file and then sends it down via a
> cfcontent tag.
>
> I'm not particularly fond of this as if for any reason the executable
> fails, you end up waiting for a timeout situation. In the past I've used a
> sleep() to just pause the page but that's not particularly ideal either.
>
> Any better options, or maybe a combination of the two?
>
>
> Mary Jo
>
>
>
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351360
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Wait for File to Get Written

2012-05-29 Thread Mary Jo Sminkey

I've run into this a number of times the last few months and couldn't find 
anything in the archives that really seemed to address it. It's a common enough 
issue that I'm sure people have dealt with it, and I'm curious what solutions 
you might use. 

Basically I have situations where I need to wait for ColdFusion to finish 
creating a file before displaying it. The legacy code I'm working with using a 
cfexecute to run an executable file, and it uses this code snippet:




So basically it loops until it finds the file and then sends it down via a 
cfcontent tag. 

I'm not particularly fond of this as if for any reason the executable fails, 
you end up waiting for a timeout situation. In the past I've used a sleep() to 
just pause the page but that's not particularly ideal either.

Any better options, or maybe a combination of the two?


Mary Jo


 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351359
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm