Skip to content

Commit f82c481

Browse files
committed
B2B-2224: Reduce session storage utilization in GraphQL by removing session in Magento\DirectoryGraphQl\Controller\HttpHeaderProcessor\CurrencyProcessor
1 parent c60f4cf commit f82c481

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

app/code/Magento/DirectoryGraphQl/Controller/HttpHeaderProcessor/CurrencyProcessor.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class CurrencyProcessor implements HttpHeaderProcessorInterface
3030

3131
/**
3232
* @var SessionManagerInterface
33+
* @deprecated
3334
*/
3435
private $session;
3536

@@ -83,19 +84,13 @@ public function processHeaderValue(string $headerValue) : void
8384
);
8485
}
8586
} else {
86-
if ($this->session->getCurrencyCode()) {
87-
/** @var \Magento\Store\Model\Store $currentStore */
88-
$currentStore = $this->storeManager->getStore() ?? $this->storeManager->getDefaultStoreView();
89-
$currentStore->setCurrentCurrencyCode($this->session->getCurrencyCode());
90-
} else {
91-
/** @var \Magento\Store\Model\Store $store */
92-
$store = $this->storeManager->getStore() ?? $this->storeManager->getDefaultStoreView();
93-
$this->httpContext->setValue(
94-
HttpContext::CONTEXT_CURRENCY,
95-
$store->getCurrentCurrency()->getCode(),
96-
$store->getDefaultCurrency()->getCode()
97-
);
98-
}
87+
/** @var \Magento\Store\Model\Store $store */
88+
$store = $this->storeManager->getStore() ?? $this->storeManager->getDefaultStoreView();
89+
$this->httpContext->setValue(
90+
HttpContext::CONTEXT_CURRENCY,
91+
$store->getCurrentCurrency()->getCode(),
92+
$store->getDefaultCurrency()->getCode()
93+
);
9994
}
10095
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
10196
//skip store not found exception as it will be handled in graphql validation

app/code/Magento/DirectoryGraphQl/etc/graphql/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@
1616
</argument>
1717
</arguments>
1818
</type>
19+
<type name="Magento\DirectoryGraphQl\Controller\HttpHeaderProcessor\CurrencyProcessor">
20+
<arguments>
21+
<argument name="session" xsi:type="object">Magento\Framework\Session\Generic\Proxy</argument>
22+
</arguments>
23+
</type>
1924
</config>

0 commit comments

Comments
 (0)