{"action":"created","issue":{"url":"https://api.github.com/repos/spree/spree/issues/6626","labels_url":"https://api.github.com/repos/spree/spree/issues/6626/labels{/name}","comments_url":"https://api.github.com/repos/spree/spree/issues/6626/comments","events_url":"https://api.github.com/repos/spree/spree/issues/6626/events","html_url":"https://github.com/spree/spree/pull/6626","id":97175008,"number":6626,"title":"Fix order deadlocks","user":{"login":"JDutil","id":25104,"avatar_url":"https://avatars.githubusercontent.com/u/25104?v=3","gravatar_id":"","url":"https://api.github.com/users/JDutil","html_url":"https://github.com/JDutil","followers_url":"https://api.github.com/users/JDutil/followers","following_url":"https://api.github.com/users/JDutil/following{/other_user}","gists_url":"https://api.github.com/users/JDutil/gists{/gist_id}","starred_url":"https://api.github.com/users/JDutil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JDutil/subscriptions","organizations_url":"https://api.github.com/users/JDutil/orgs","repos_url":"https://api.github.com/users/JDutil/repos","events_url":"https://api.github.com/users/JDutil/events{/privacy}","received_events_url":"https://api.github.com/users/JDutil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-07-25T00:34:22Z","updated_at":"2015-09-30T16:39:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/spree/spree/pulls/6626","html_url":"https://github.com/spree/spree/pull/6626","diff_url":"https://github.com/spree/spree/pull/6626.diff","patch_url":"https://github.com/spree/spree/pull/6626.patch"},"body":"* Remove unneded DB state cleanup\r\n* Remove unneded stubbing of private interface\r\n* Remove unneded memoization layer\r\n* Remove spec setup duplication\r\n* Fix specification holes for #current_order\r\n* Fix locking for all query paths in #current_order\r\n* Removes Spree::User.last_incomplete_spree order.\r\n* Adds collection Spree::User.incomplete_spree orders for being able to\r\n  lock records in one DB round trip\r\n* Remove redundant persistance call\r\n* Fix public interface smell\r\n  * Refactor options based semantics of current_order out into cart_order\r\n    method.\r\n  * Removes the options paramter, making the methods properly memoizable\r\n* Fix memoizers to memoize nil correctly\r\n  * The current_order helper used to query for the same inexisting rows\r\n    per call to `current_order`. There is only one call side that\r\n    invalidates the current_order cache via active writes to the\r\n    `@current_order` ivar.\r\n* Fix tuple order to be deterministic\r\n* Fix specification holes in #set_current_order\r\n* Add specs that cover all selection logic\r\n* Do not pass redundant user argument to Order#merge!\r\n  When orders are found by current user, there is no need to pass it in.\r\n* Add locking to #set_current_order\r\n* Remove simple_current_order interface\r\n* Refactor Spree::Core::ControllerHelpers::Order#cart_order\r\n* Refactor Spree::Core::ControllerHelpers::Order#current_order\r\n* This change centralizes all the merging of incomplete user and\r\n  anonymous orders.\r\n* Change order to always be associated to the user when set.\r\n* Remove fix for #3346 since the created_by field is always set when\r\n  associating the order to the user.\r\n* Simplify specs to not depend on the implementation of current_order\r\n* Refactor Spree::Core::ControllerHelpers::Order#current_currency\r\n* Remove code that isn't necesarry from the specs and library\r\n* Change Spree::Order.incomplete to return orders from newest to oldest\r\n* Remove Spree::LegacyUser#incomplete_spree_orders\r\n* Remove Spree::Core::ControllerHelpers::Order#current_order_params\r\n* Kill mutations in Spree::Core::ControllerHelpers::Order\r\n\r\nConflicts:\r\n\tapi/app/controllers/spree/api/orders_controller.rb\r\n\tcore/app/helpers/spree/base_helper.rb\r\n\tcore/config/initializers/user_class_extensions.rb\r\n\tcore/lib/spree/core/controller_helpers/order.rb\r\n\tfrontend/app/controllers/spree/checkout_controller.rb\r\n\tfrontend/app/controllers/spree/orders_controller.rb\r\n\tfrontend/app/controllers/spree/store_controller.rb\r\n\tfrontend/spec/controllers/spree/orders_controller_spec.rb\r\n\r\nFixes #2683 \r\n\r\n/cc @mbj @tesserakt @jasonfb I've attempted to cherry-picking @mbj and his teams work from https://github.com/MountainRoseHerbs/spree/commit/8e040d24daa20f3befba3fe38eebf369fe35ae11#diff-0a7e681efdb2cb600526df2c5af10039 to apply against master branch here.  Will see what specs have to say, and would be good to get your feedback."},"comment":{"url":"https://api.github.com/repos/spree/spree/issues/comments/144470635","html_url":"https://github.com/spree/spree/pull/6626#issuecomment-144470635","issue_url":"https://api.github.com/repos/spree/spree/issues/6626","id":144470635,"user":{"login":"mbj","id":117966,"avatar_url":"https://avatars.githubusercontent.com/u/117966?v=3","gravatar_id":"","url":"https://api.github.com/users/mbj","html_url":"https://github.com/mbj","followers_url":"https://api.github.com/users/mbj/followers","following_url":"https://api.github.com/users/mbj/following{/other_user}","gists_url":"https://api.github.com/users/mbj/gists{/gist_id}","starred_url":"https://api.github.com/users/mbj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbj/subscriptions","organizations_url":"https://api.github.com/users/mbj/orgs","repos_url":"https://api.github.com/users/mbj/repos","events_url":"https://api.github.com/users/mbj/events{/privacy}","received_events_url":"https://api.github.com/users/mbj/received_events","type":"User","site_admin":false},"created_at":"2015-09-30T16:39:14Z","updated_at":"2015-09-30T16:39:14Z","body":"I'll reply deeply later the week, currently too busy with private measures. Also our client project will soon run code closer to master allowing me to upstream this in a more efficient way."}}