What's the best way of getting the processing of a CF template to 'pause' for a certain amount of time?
I'm testing for the value of a certain application variable. I want a DB query to be processed only if the value of this var gets set to 'true' within, say, 5 seconds. At the moment I've got a CFLOOP that keeps going round, testing the var, as long as the time isn't 5 seconds later than when it started: <cfset queryDone=0> <cfset startTime=CreateODBCDateTime(Now())> <cfloop condition="(NOT queryDone) AND (DateDiff('s', startTime,CreateODBCDateTime(Now())) LTE 5)"> <cflock timeout="10" throwontimeout="No"> <cfset locked=application.locked> </cflock> <cfif NOT locked> <cfquery name="queryName" datasource="#request.DSN#" dbtype="ODBC"> [SQL] </cfquery> ---> <cfset queryDone=1> </cfif> </cfloop> (The app has to be in CF 4.0, hence simple CFLOCK and no Duplicate). Is this long-winded? Anything more elegant? Any suggestions appreciated :) - Gyrus ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists