Someone else probably already mentioned this. The productmenu function
is not thread safe, although it's not a huge issue. Each time the
function executes it places the query result in the variables scope of
the cfc, which isn't where you want it generally speaking... However,
the danger with this particular race condition for the moment is small.
It might result in someone getting a menu that contains a category that
doesn't have any products in it, or not containing one that does. 

But also in this case, even if you elminate the race condition within
the function, the end result of the user seeing a slightly incorrect
menu would still exist because the race condition is also created again
by the nature of the web. A guy hits the page, gets the menu and then
off somewhere else the client deletes that category. But the user still
has the page open in their browser and when they click the link, bang!
They come to a page that may or may not work because the category
doesn't exist or maybe doesn't have any products in it. 

But this is the kind of race condition that a lot of applications have and
rarely becomes an issue because well, for starters the people using the
site have to do several things at the same time and while selecting a
category is common, deleting one is not. So right off the bat, you're
not likely to see the result of the race condition very often, because
someone has to delete a category or deactivate its last product first
and that rarely happens. And then even on the rare occasion on which all
these events line up just right, I'm not sure how many people will
actually report the error or the page that's not working to the store.
Often it's not so important to them and just going somewhere else is
easier. 

So yeah, in that case, the fact that you're not having problems is kind
of coincidental. 

If we're talking about best practice on the other hand, you always want
to use a <cfset var queryname = 0 /> before every query in your CFCs. 

-- 
s. isaac dealey  ^  new epoch
 isn't it time for a change? 
     ph: 781.769.0723

http://onTap.riaforge.org/blog



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317278
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to