Closed (fixed)
Project:
Ubercart
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Feb 2009 at 16:43 UTC
Updated:
3 Jan 2014 at 00:07 UTC
Jump to comment: Most recent
Comments
Comment #1
cha0s commentedThis won't keep a predicate from running over the same entity if it's modified, will it? It seems to just take a snapshot of the arguments, so if one changed the key won't match later, correct?
Comment #2
rszrama commentedComment #3
Island Usurper commentedMaybe. I'm not sure. I'm convinced that the initial patch isn't the right thing to do, though.
Comment #4
cha0s commentedI think you're right though. We should discuss the drawbacks of not locking and go from there... One I can think of would be potential for infinite recursion... but I don't know if that alone justifies it. With power comes responsibility, ya know?
Comment #5
cha0s commentedI'm starting to think this locking business is going to cause us a lot of problems. I realized this problem is tied closely to this issue: http://www.ubercart.org/forum/support/9293/file_product_not_asigned_user... and, also, I'm thinking this one: http://drupal.org/node/331667
We need to determine what path to take on this one and figure out a way to work around the locking if we end up considering it necessary. My feeling is that we should remove the locks... they afford a little performance gain, but in the case of these issues, maybe a bit of premature optimization as well.
Comment #6
univate commentedI have just run into this problem as well.
The patch above seems to make more sense then what is currently in the code. Ie: you should be able to perform the same action on different sets of arguments.
As far as I can see the thing that needs to be avoided here is the case where the exact some CA is evaluated twice, things like the same email getting sent to a user more then one.
But if there is going to be locking then it needs to lock on both the predicates and what its acting on.
Comment #7
Island Usurper commentedThe patch in the original post was included in the file posted in #399586-52: cha0s' attempt to solve the VAT display stuff, which was committed. I think we could have avoided several bug reports if this had been committed earlier, but that's the way it goes sometimes.
Let's keep an eye on the results of any actions that get done. If some of them start happening twice when they shouldn't, then we'll have to revisit this.
Comment #8
mikey_p commentedThis is still locking in ways that I wouldn't expect.
Please see this snippet of code from UC Product Triggers module.
The idea here is to pair this with something like the CA Taxonomy module, and then be able to act on groups of nodes added or removed from the shopping cart. However this doesn't work as the locking makes it process on the first trigger pull only, and not subsequent calls to ca_trigger_pull().
I was using the patch from http://www.ubercart.org/comment/34894/Re_Hey_Neil_Are_you_saying to make this work better, but I'd like to find a better solution. (And I'd really like to get this into ubercart before release)
Comment #9
cha0s commentedI would like to state again that I think we should discuss in a little more depth the possibility of ditching the locks completely.
Comment #10
mikey_p commentedSome options here:Option 1Where $args is an array of all the arguments to be evaluated, and $lock could be passed to ca_load_trigger_predicates().
Ideally we could keep them if there was a way to selectively disable them.
Option 2 (ugly)Alternatively until then, modules like UC Product Triggers could implement their own version of ca_pull_trigger() and ca_load_trigger_predicates().
(ca_pull_trigger_unlocked() or ca_load_trigger_predicates_unlocked() or some such )
Option 3 (ugly)Add a $reset param to ca_load_trigger_predicates().
Nevermind, I need to check the latest releases more often. I was still looking at beta6.
Comment #11
Island Usurper commentedIt feels like getting discounts to work on several nodes on a page is getting harder and harder to do. The latest thing I've heard comes from someone who was using views in blocks, and only the first product was getting a discount. They might not have had the change that's already been committed yet, so it might be a false alarm.
Even still, I think I'm in favor of removing the locks.