• Heinrich Lee Yu's avatar
    Prevent unnecessary sticking to the DB primary · 2de84b47
    Heinrich Lee Yu authored
    Experiments can be run on high-traffic read-only pages and when a
    transaction is initiated, our load balancing code will direct all
    queries to the primary.
    
    This update is a no-op most of the time so we skip the update when
    we detect that the attributes haven't changed.
    
    ActiveRecord actually already does this under the hood but a
    `#transaction` call is still made in the process causing the
    undesired behavior with our load balancer.
    2de84b47
experiment.rb 2.1 KB