Details
Assignee
Michael OffnerMichael OffnerReporter
tom chivertontom chivertonPriority
MajorLabels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
tom chiverton
tom chivertonPriority
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Created 3 November 2015 at 16:43
Updated 19 May 2021 at 11:39
This code should stop early or error for a concurrent request, as the sleep() for the winner is longer than the timeout. It doesn't, it waits for the first one to finish then completes.
<cfset sessionFlag='adminRunningLock'/> <cflock name="#sessionFlag#" type="exclusive" timeout="1" throwOnTimeout="true"> <cfif structKeyExists(session,sessionFlag)>a already running. Not running again<br> Started at <cfoutput>#session[sessionFlag]#</cfoutput> <cfabort/> <cfelse>b <cfset sleep(5000)/> <cfif structKeyExists(session,sessionFlag)>d already running. Not running again !<br> Started at <cfoutput>#session[sessionFlag]#</cfoutput> <cfabort/> </cfif>e <cfset session[sessionFlag]=now()/>f </cfif> </cflock> * <cfoutput>#session[sessionFlag]#</cfoutput>