Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wait function?

Status
Not open for further replies.

capitano

Programmer
Jul 30, 2001
88
US
I have a two step process:
1. Upload a file using <cffile action=&quot;upload&quot;....
2. Run a Unix executable PERL script on the file to do a bunch of things. (using <cfexecute>)

I have the following problem, however: the <cfexecute> and corresponding PERL script cannot find the file on the server. I think this is because <cffile> doesn't have enough time to upload before the <cfexecute> begins. Is there a &quot;wait&quot; function, so I can wait until the file is totally uploaded before beginning my cfexecute routine??

Any other recommendations for how to synchronize these operations?

Thanks!
 
Thanks much for those links. Unfortunately, I'm working on a server where the admin doesn't like Java. So those CFX tags won't work for me. But you gave me the idea to create my own wait function:

<cfset wait_time = 5>
<cfset Future = Second(Now()) + wait_time>
<cfloop index=&quot;Z&quot; from=&quot;1&quot; to=&quot;1000000000000&quot; step=&quot;+1&quot;>
<cfif Second(Now()) GTE Future>
<cfbreak>
</cfif>
</cfloop>

There's probably more graceful (less CPU intensive) ways to do it. But I figure, waiting for 5 seconds probably won't smoke the CPU.

Thanks all!
 
How 'bout simply:

Code:
<CFSET nWaitSeconds = 5>
<CFSET nStartTicks = GetTickCount()>
<CFLOOP condition=&quot;GetTickCount() LTE (nStartTicks + (nWaitSeconds * 1000))&quot;>
    <!--- do nothing --->
</CFLOOP>

The odd thing is that we usually don't &quot;sleep&quot; ColdFusion. Since all ColdFusion processing occurs server-side, before the browser typically sees the result, all you're doing is delaying the rendering of the page in it's entirety.

The exception is when you're using CF 5.0 and you call CFFLUSH to render pages in bits and pieces... but even then, it's doubtful that CFFLUSH will actually flush any data unless you're doing some pretty intensive display of records or such (CFFLUSH doesn't actually &quot;flush&quot; unless a certain character count has already filled it's buffer).

Perhaps you'd be better served by using javascript to pause something on the page.


-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top