I want to add a scheduled task. But I do not want the actions of this task to run at the same time. To test this i added a sleep loop to the page to make sure the request lasts long enough to test concurrent requests and then I just run the page twice in two different browsers.
I have tried wrapping my code in a cflock with a short timeout but the timeout does not seem to work. The second call just hangs until the previous request is finished. ex. <cftry> <cflock name="ScheduleLock" timeout="1" type="EXCLUSIVE" throwontimeout="yes"> [CODE GOES HERE] </cflock> <cfcatch type="Lock">Already running</cfcatch> </cftry> I have tried creating a flag variable in the application scope which i set to true at the top and false at the bottom. At the top I have a check to see if the flag is set and abort if it is. ex. <cfset LockName="ScheduleLock" /> <cfif StructKeyExists(application, LockName) AND application[LockName] EQ true> Currently Running<cfabort> <cfelse> <cfset application[LockName]=true /> </cfif> [CODE GOES HERE] <cfset LockName="BatchEmailProccessorLock" /> I have made sure that each request is in the same application, but the second request still waits for the previous request to complete. Does anyone have a better idea. Running on CF7 Standard Edition. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298665 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4