Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of Taxon promotion rule #1409

Closed
wants to merge 1 commit into from
Closed

Improve performance of Taxon promotion rule #1409

wants to merge 1 commit into from

Commits on Mar 28, 2017

  1. Improve performance of Taxon promotion rule

      1) Before #actionable? was bringing all product ids of the rule's taxons
         from the database. On a particular case in a store with 1mil
         products, the promotion was bringing 0.6mil of them, with a query ~ 5sec
         and 5mil ids in Ruby.
    
         After, the exists? query is a milliseconds one.
    
    
      2) Before #eligible? was fetching all parent taxons of each taxon on a
         product, which is not required for the match process.
    
         So, given an order with 10 line items, with each line item having a
         product with 3 taxons, each of them having 2 parent taxons
         would mean 30 queries to the db to fetch the ancestors, bringing a
         total of 60 taxons in Ruby memory.
    
         All of them unnecessary, as the matching processes can be done solely
         based on the rule's taxons, which if 5 would mean 5 queries to the DB
         (self_and_descendants)
    
    
      3) Fix incorrect test on #eligible?#all for taxon child of a taxon rule
         case.
    
         * there were no children tested in the case
    
    
      4) On #eligible?#all, take only the IDs from the DB to
         reduce memory overhead
    mtomov committed Mar 28, 2017
    Configuration menu
    Copy the full SHA
    3a28677 View commit details
    Browse the repository at this point in the history