Skip to content

Commit ae92340

Browse files
Revert "AC-12755 Improve web api async request processor"
This reverts commit 18cb466.
1 parent 45cc4db commit ae92340

File tree

3 files changed

+10
-236
lines changed

3 files changed

+10
-236
lines changed

app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ public function resolve()
120120
$this->inputArraySizeLimitValue->set($route->getInputArraySizeLimit());
121121

122122
foreach ($inputData as $key => $singleEntityParams) {
123-
if (!is_array($singleEntityParams)) {
124-
continue;
125-
}
126-
127123
$webapiResolvedParams[$key] = $this->resolveBulkItemParams(
128124
$singleEntityParams,
129125
$routeServiceClass,

app/code/Magento/WebapiAsync/Controller/Rest/AsynchronousRequestProcessor.php

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
use Magento\Framework\Reflection\DataObjectProcessor;
1818
use Magento\AsynchronousOperations\Api\Data\AsyncResponseInterfaceFactory;
1919
use Magento\AsynchronousOperations\Api\Data\AsyncResponseInterface;
20-
use Magento\Framework\Webapi\Rest\Request;
21-
use Magento\Framework\Webapi\Exception;
2220

2321
/**
2422
* Responsible for dispatching single and bulk requests.
@@ -27,8 +25,8 @@
2725
*/
2826
class AsynchronousRequestProcessor implements RequestProcessorInterface
2927
{
30-
public const PROCESSOR_PATH = "/^\\/async(\\/V.+)/";
31-
public const BULK_PROCESSOR_PATH = "/^\\/async\/bulk(\\/V.+)/";
28+
const PROCESSOR_PATH = "/^\\/async(\\/V.+)/";
29+
const BULK_PROCESSOR_PATH = "/^\\/async\/bulk(\\/V.+)/";
3230

3331
/**
3432
* @var \Magento\Framework\Webapi\Rest\Response
@@ -89,9 +87,9 @@ public function __construct(
8987
}
9088

9189
/**
92-
* @inheritdoc
90+
* {@inheritdoc}
9391
*/
94-
public function process(Request $request)
92+
public function process(\Magento\Framework\Webapi\Rest\Request $request)
9593
{
9694
$path = $request->getPathInfo();
9795
$path = preg_replace($this->processorPath, "$1", $path);
@@ -121,10 +119,7 @@ public function process(Request $request)
121119
}
122120

123121
/**
124-
* Get topic name from webapi_async_config services config array by route url and http method
125-
*
126122
* @param \Magento\Framework\Webapi\Rest\Request $request
127-
*
128123
* @return string
129124
*/
130125
private function getTopicName($request)
@@ -138,58 +133,29 @@ private function getTopicName($request)
138133
}
139134

140135
/**
141-
* @inheritdoc
136+
* {@inheritdoc}
142137
*/
143-
public function canProcess(Request $request)
138+
public function canProcess(\Magento\Framework\Webapi\Rest\Request $request)
144139
{
145-
if ($request->getHttpMethod() === Request::HTTP_METHOD_GET) {
140+
if ($request->getHttpMethod() === \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET) {
146141
return false;
147142
}
148143

149144
if (preg_match($this->processorPath, $request->getPathInfo()) === 1) {
150-
return $this->checkSelfResourceRequest($request);
145+
return true;
151146
}
152-
153147
return false;
154148
}
155149

156150
/**
157-
* Check if current request is bulk request
158-
*
159-
* @param Request $request
151+
* @param \Magento\Framework\Webapi\Rest\Request $request
160152
* @return bool
161153
*/
162-
public function isBulk(Request $request)
154+
public function isBulk(\Magento\Framework\Webapi\Rest\Request $request)
163155
{
164156
if (preg_match(self::BULK_PROCESSOR_PATH, $request->getPathInfo()) === 1) {
165157
return true;
166158
}
167159
return false;
168160
}
169-
170-
/**
171-
* Check if current request is self resource request
172-
*
173-
* @param Request $request
174-
* @return bool
175-
*
176-
* @throws Exception
177-
*/
178-
private function checkSelfResourceRequest(Request $request): bool
179-
{
180-
$path = preg_replace($this->processorPath, "$1", $request->getPathInfo());
181-
$request->setPathInfo(
182-
$path
183-
);
184-
185-
$route = $this->inputParamsResolver->getRoute();
186-
$aclResources = $route->getAclResources();
187-
188-
// We do not process self resource requests asynchronously
189-
if (in_array('self', $aclResources, true)) {
190-
return false;
191-
}
192-
193-
return true;
194-
}
195161
}

app/code/Magento/WebapiAsync/Test/Unit/Controller/AsynchronousRequestProcessorTest.php

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

0 commit comments

Comments
 (0)