Changes for page Batch запити
Last modified by Ashterix on 2024/05/16 18:58
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -11,6 +11,8 @@ 11 11 12 12 Let's imagine we are developing a backend API for an online store and we already have a method {{code language="none"}}ProductService.getInfo{{/code}} for the entity {{code language="none"}}Product{{/code}}. The task on the frontend is to implement the logic of adding products to the cart and updating product information upon request (for example, when opening the cart, we need to update information about the products the user added: availability, prices, descriptions, etc.). 13 13 14 +In a classical scenario, there are two approaches: 15 + 14 14 == Scenario that 100% of developers follow == 15 15 16 16 A task is set for the backend to create a separate API method that returns a collection of objects by an array of identifiers. This requires the working time of a backend developer, a tester, and a frontend developer since the new method must be covered by unit tests and additional scenarios for regression testing. This must be done despite having a method that can return one product by its id. ... ... @@ -204,7 +204,7 @@ 204 204 205 205 When receiving an array of requests, the RPC Server creates a queue of [[Symfony Process>>https://symfony.com/doc/current/components/process.html]], i.e., it runs CLI commands that are processed asynchronously. In a while loop, the state of the processes is checked, and if a result is obtained, it is added to the response array. If there is no response before the timeout expires, an error is returned indicating that the request was not processed. 206 206 207 -== Algorithm == 209 +== Algorithm: == 208 208 209 209 * The batch request is split into individual requests, each of which is added to the queue. 210 210 * The queue is checked in a loop for the presence of objects. ... ... @@ -236,3 +236,4 @@ 236 236 {{/code}} 237 237 238 238 This allows you to adjust the duration of waiting for results for methods that might take longer to execute, which can be important for processing certain requests. 241 +