Q:

onRequestStart CFWheels

I am having some concurrency issues in cfwheels. 
I have some code in events/onrequeststart.cfm that is being executed every time the user is requesting something.  
Test case:
User A - request time: 10sec
User B - request time: 2sec
If the user B issues a request while the user A is already working on a request, user's B settings will go into user A and user A will display results based on user's B request. 
I tried using cflock on the onrequeststart.cfm but it doesn't seem to work.  I don't have much experience with cfwheels so I maybe trying to do something that is logically wrong. 
This is part of the code that gets confused. 
    <cfquery name="currentUser" datasource="#application.ds#">
        select * from clientadmin where clientAdminid ='#session.clientadminid#'
    </cfquery>

    <cfquery name="currentClient" datasource="#application.ds#">
        select * from clientBrands where clientbrandID ='#currentUser. ClientBrandID#'
    </cfquery>

<cfset application.clientAdminSurveys = application.generalFunctions.clientSurveys(clientAdminID=session.clientAdminID, clientBrandID = currentUser.clientBrandID)>
<cfset application. AssociatedDoctors = application.generalFunctions. AssociatedDoctors(clientAdminID=session.clientAdminID, clientBrandID = currentUser.clientBrandID)>

So, I guess my question is, how to avoid this from happening?  

A:

1) The Application scope is "application wide" (all users of site wide) - you shouldn't be setting per user settings there, ever, as as you've discovered, user B overwrites user A. Use the session scope for per user stuff.  So in your last two lines you're setting application scope stuff using session scope data! 
2) As a side note, in wheels you can use application.wheels.datasourcename to get the database name

