Skip to content

Commit fe3525e

Browse files
committed
LYNX-199: Eliminate double place order locking
1 parent 70f8114 commit fe3525e

File tree

5 files changed

+1
-227
lines changed

5 files changed

+1
-227
lines changed

app/code/Magento/QuoteGraphQl/Model/Cart/PlaceOrderMutex.php

Lines changed: 0 additions & 72 deletions
This file was deleted.

app/code/Magento/QuoteGraphQl/Model/Cart/PlaceOrderMutexInterface.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\QuoteGraphQl\Model\Resolver;
99

10-
use Magento\Framework\App\ObjectManager;
1110
use Magento\Framework\Exception\LocalizedException;
1211
use Magento\Framework\GraphQl\Config\Element\Field;
1312
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
@@ -17,7 +16,6 @@
1716
use Magento\QuoteGraphQl\Model\Cart\GetCartForCheckout;
1817
use Magento\GraphQl\Model\Query\ContextInterface;
1918
use Magento\QuoteGraphQl\Model\Cart\PlaceOrder as PlaceOrderModel;
20-
use Magento\QuoteGraphQl\Model\Cart\PlaceOrderMutexInterface;
2119
use Magento\Sales\Api\OrderRepositoryInterface;
2220

2321
/**
@@ -45,30 +43,22 @@ class PlaceOrder implements ResolverInterface
4543
*/
4644
private $errorMessageFormatter;
4745

48-
/**
49-
* @var PlaceOrderMutexInterface
50-
*/
51-
private $placeOrderMutex;
52-
5346
/**
5447
* @param GetCartForCheckout $getCartForCheckout
5548
* @param PlaceOrderModel $placeOrder
5649
* @param OrderRepositoryInterface $orderRepository
5750
* @param AggregateExceptionMessageFormatter $errorMessageFormatter
58-
* @param PlaceOrderMutexInterface|null $placeOrderMutex
5951
*/
6052
public function __construct(
6153
GetCartForCheckout $getCartForCheckout,
6254
PlaceOrderModel $placeOrder,
6355
OrderRepositoryInterface $orderRepository,
64-
AggregateExceptionMessageFormatter $errorMessageFormatter,
65-
?PlaceOrderMutexInterface $placeOrderMutex = null
56+
AggregateExceptionMessageFormatter $errorMessageFormatter
6657
) {
6758
$this->getCartForCheckout = $getCartForCheckout;
6859
$this->placeOrder = $placeOrder;
6960
$this->orderRepository = $orderRepository;
7061
$this->errorMessageFormatter = $errorMessageFormatter;
71-
$this->placeOrderMutex = $placeOrderMutex ?: ObjectManager::getInstance()->get(PlaceOrderMutexInterface::class);
7262
}
7363

7464
/**
@@ -80,25 +70,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8070
throw new GraphQlInputException(__('Required parameter "cart_id" is missing'));
8171
}
8272

83-
return $this->placeOrderMutex->execute(
84-
$args['input']['cart_id'],
85-
\Closure::fromCallable([$this, 'run']),
86-
[$field, $context, $info, $args]
87-
);
88-
}
89-
90-
/**
91-
* Run the resolver.
92-
*
93-
* @param Field $field
94-
* @param ContextInterface $context
95-
* @param ResolveInfo $info
96-
* @param array|null $args
97-
* @return array[]
98-
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
99-
*/
100-
private function run(Field $field, ContextInterface $context, ResolveInfo $info, ?array $args): array
101-
{
10273
$maskedCartId = $args['input']['cart_id'];
10374
$userId = (int)$context->getUserId();
10475
$storeId = (int)$context->getExtensionAttributes()->getStore()->getId();

app/code/Magento/QuoteGraphQl/etc/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<preference for="Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValueInterface" type="Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Composite" />
1010
<preference for="Magento\QuoteGraphQl\Model\CartItem\DataProvider\Processor\ItemDataProcessorInterface" type="Magento\QuoteGraphQl\Model\CartItem\DataProvider\Processor\ItemDataCompositeProcessor" />
1111
<preference for="Magento\QuoteGraphQl\Model\CartItem\PrecursorInterface" type="Magento\QuoteGraphQl\Model\CartItem\PrecursorComposite" />
12-
<preference for="Magento\QuoteGraphQl\Model\Cart\PlaceOrderMutexInterface" type="Magento\QuoteGraphQl\Model\Cart\PlaceOrderMutex" />
1312
<type name="Magento\QuoteGraphQl\Model\Resolver\CartItemTypeResolver">
1413
<arguments>
1514
<argument name="supportedTypes" xsi:type="array">

dev/tests/api-functional/testsuite/Magento/QuoteGraphQl/Model/Cart/PlaceOrderMutexTest.php

Lines changed: 0 additions & 97 deletions
This file was deleted.

0 commit comments

Comments
 (0)