Network request control method and device

By using message queues and interceptor logic in mobile applications, the request timing problem in traditional methods is solved, achieving efficient parallel processing and flexible control over the priority of network requests, thereby improving processing efficiency and user experience.

CN121567780APending Publication Date: 2026-02-24THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510472729.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

In mobile applications, traditional network request handling methods cause request timing issues and affect processing efficiency, and cannot flexibly control request priority.

Method used

A message queue-based network request control method is adopted. By inserting interceptor messages and using a synchronization barrier mechanism, efficient parallel processing of network requests is ensured, and the request order is controlled according to priority and execution order.

Benefits of technology

It achieves efficient parallel processing of network requests while ensuring the flexibility and specific order of request execution, thereby improving the processing efficiency of network requests and the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121567780A_ABST
    Figure CN121567780A_ABST
Patent Text Reader

Abstract

The invention discloses a network request control method and device, and relates to the field of computer networks. A specific embodiment of the method comprises the following steps: acquiring a network request to be sent to a background server by a front end; the network requests are inserted into a message queue in a message mode, when a target network request needing to be executed preferentially exists in the network requests, the target network request is inserted into a preset position of the message queue, and an interceptor message is set behind the target network request in the message queue; and calling a network engine to take out the message from the message queue, and sending a network request in the message to a background server in parallel. Network requests can be efficiently processed, and the execution sequence of executing the network requests can be set according to needs. The invention further provides a corresponding device, electronic equipment and a computer readable medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a network request control method, apparatus, electronic device, and computer-readable medium. Background Technology

[0002] In mobile applications, interaction with the backend is often required, using network requests to retrieve backend data and complete a specific function. Sometimes, a higher-priority task needs to be inserted before a network request, or there may be one or more preceding dependent requests. In such scenarios, the traditional solution is to add a priority queue to sort the inserted requests, executing all requests serially. While this method can solve the request sequencing problem to some extent, executing all requests serially is neither flexible enough nor efficient enough for the network module. Summary of the Invention

[0003] In view of this, embodiments of the present invention provide a network request control method based on a message queue, which can efficiently process network requests and flexibly control the priority of network requests. Specifically, embodiments of the present invention provide a network request control method applied to a terminal, comprising the following steps:

[0004] Get the network requests that the frontend is about to send to the backend server;

[0005] Network requests are inserted into a message queue as messages. When there is a target network request that needs to be executed first in the network requests, the target network request is inserted into a preset position in the message queue, and an interceptor message is set after the target network request in the message queue. The interceptor message contains interceptor logic, which is configured to control that the interceptor message can only be consumed after the message before the interceptor message has been consumed.

[0006] The network engine is invoked to retrieve messages from the message queue and send the network requests contained in the messages to the backend server in parallel.

[0007] In some embodiments of the present invention, invoking the network engine to retrieve messages from the message queue in parallel and sending the network requests in the messages to the backend server includes:

[0008] When the message contains a network request, the network engine is invoked to send the network request to the backend server. Based on the correct response returned by the backend server for the network request, the message containing the network request in the message queue is indicated to have been consumed.

[0009] When the message is an interceptor message, the interceptor logic is executed.

[0010] In some embodiments of the present invention, inserting network requests into a message queue as messages includes:

[0011] Get the priority of the network requests and insert them into the message queue according to the priority order.

[0012] In some embodiments of the present invention, the interceptor logic is further configured as follows:

[0013] Once the messages preceding the interceptor message have been consumed, the interceptor message has also been consumed.

[0014] Alternatively, it can be configured such that after the message preceding the interceptor message has been consumed, the execution logic in the interceptor logic is executed, and after the execution logic has been executed, the interceptor message has been consumed.

[0015] In some embodiments of the present invention, the execution logic includes chained execution logic composed of multiple individual execution logics linked together in execution order, and the execution interceptor logic includes:

[0016] Once the current single execution logic is completed, the next single execution logic will be executed in the execution order until the chain of execution logic is completed.

[0017] In some embodiments of the present invention, when the execution logic includes logic for requesting information from a background server, in response to the execution logic receiving a state of failure to obtain information, the execution logic is inserted into a message queue in the form of a message, and the message corresponding to the execution logic is located before the interceptor message.

[0018] In some embodiments of the present invention, the preset position is the front end of the message queue.

[0019] According to another aspect of the present invention, a network request control device is also provided, applied to a front end, including a network request acquisition module, a message queue management module, and a network engine invocation module, wherein...

[0020] The network request acquisition module is configured to acquire network requests that the frontend is about to send to the backend server;

[0021] The message queue management module is configured to insert network requests into the message queue as messages. When there is a target network request that needs to be executed first in the network request, the target network request is inserted into the preset position of the message queue, and an interceptor message is set after the target network request in the message queue. The interceptor message contains interceptor logic, which is configured to control that the interceptor message can only be consumed after the message before the interceptor message has been consumed.

[0022] The network engine invocation module is configured to invoke the network engine to retrieve messages from the message queue and send the network requests in the messages to the backend server in parallel.

[0023] According to another aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the embodiments of the present invention.

[0024] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the embodiments of the present invention.

[0025] One embodiment of the above invention has the following advantages or beneficial effects: In this embodiment of the invention, front-end network requests are inserted into the message queue in the form of messages. The network engine can retrieve messages from the message queue in parallel and send the network requests therein to the back-end server for processing, which improves the efficiency of sending network requests. At the same time, interceptors can be set according to the priority of network requests. After the network requests that need to be executed first are executed, interceptor messages are set to ensure that the network requests that need to be executed first are executed. After the network requests that need to be executed first are executed, subsequent network requests will be executed. In the process of ensuring efficient parallel processing of network requests, network requests can also be set to be executed in a specific order, which improves the flexibility of network request processing.

[0026] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0027] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0028] Figure 1 This is a schematic diagram of the overall architecture of a network request control system according to some embodiments of the present invention;

[0029] Figure 2 This is a flowchart illustrating a network request control method according to some embodiments of the present invention;

[0030] Figure 3 This is a schematic diagram illustrating the process of a network engine processing messages in a message queue according to some embodiments of the present invention.

[0031] Figure 4 This is a schematic diagram of the network engine processing network requests in parallel according to some embodiments of the present invention;

[0032] Figure 5 This is a schematic diagram illustrating how the network engine processes network requests after intercepting messages, according to some embodiments of the present invention.

[0033] Figure 6 This is a schematic diagram illustrating the insertion of network requests into a message queue according to network request priority in some embodiments of the present invention;

[0034] Figure 7 This is a schematic diagram of the structure of interceptor messages in a message queue according to some embodiments of the present invention;

[0035] Figure 8 This is a schematic diagram of the network engine processing interceptor logic in the message queue according to some embodiments of the present invention;

[0036] Figure 9 This is a schematic diagram of the architecture of a network request control device according to some embodiments of the present invention;

[0037] Figure 10 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0038] Figure 11 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0039] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0040] The concepts involved in the embodiments of the present invention will be introduced below.

[0041] The message queue mentioned in this embodiment of the invention is a data structure that stores and manages messages according to the First-In-First-Out (FIFO) principle. In front-end scenarios, messages can be various types of data or instructions, such as function calls, event notifications, status updates, network requests, etc. Message queues have the following advantages: 1. Message queues decouple producers (codes that send messages) from consumers (codes that receive and process messages). Producers do not need to care when or how consumers process messages; they only need to put messages into the queue. 2. Ordering: Message queues ensure that messages are processed in the order they are enqueued, which is crucial for tasks that require sequential execution.

[0042] The synchronization barrier mechanism mentioned in this embodiment of the invention is a concurrency control mechanism, also often referred to as a barrier or synchronization point. It is used to ensure that a group of tasks all reach a common execution point before proceeding to the next task. This mechanism is commonly used in parallel processing programs to ensure data consistency, satisfy dependencies between tasks, or coordinate the activities of multiple execution units.

[0043] The interceptor mentioned in this embodiment of the invention is a widely used component in software architecture, mainly used for preprocessing and post-processing during request processing. It can perform specific operations before and after the request reaches the target processing logic, thereby achieving functions such as permission verification, logging, performance monitoring, and data validation.

[0044] The network engine mentioned in this embodiment of the invention is responsible for handling data interaction between the front end and the server. For example, the network engine can be Axios, which can be used in both browsers and Node.js environments. It supports request and response interceptors and can perform some preprocessing operations before the request is sent and after the response is received. It can automatically transform request and response data (such as automatic parsing and serialization of JSON data) and support sending multiple requests at the same time (such as the axios.all method).

[0045] like Figure 1 As shown, this embodiment of the invention provides a network request control system 100 that can run the network request control method of this embodiment of the invention, including a front-end 110 and a back-end server 120. The front-end 110 is also provided with a message queue 111 and a network engine 112.

[0046] like Figure 2 As shown, the embodiments of the present invention are based on... Figure 1 The network request control system 100 shown provides a network request control method applied to the front end 110, including:

[0047] S210: Obtain the network requests to be sent from the front end to the back end server. In this embodiment of the invention, when a user conducts business on the front end 110, the front end 110 sends network requests to the back end server 120. Each business transaction involves multiple network requests, such as requesting back end authentication, verifying login status, and sending messages. In some embodiments of the invention, the processing of some network requests requires the processing results of other network requests. For example, for transaction business processing, transaction password verification requests, login validity verification requests, and transaction message sending requests may be generated. To ensure transaction security, the transaction message sending request is only sent after the login validity verification request and transaction password verification request have been processed. Therefore, different network requests have execution priorities. Executing them out of order will lead to errors in business processing.

[0048] S220: Network requests are inserted into a message queue as messages. When a target network request that needs to be executed first exists among the network requests, the target network request is inserted into a preset position in the message queue, and an interceptor message is set after the target network request in the message queue. The interceptor message contains interceptor logic, which is configured to control that the interceptor message can only be consumed after all messages preceding it have been consumed. In this embodiment of the invention, a synchronization barrier mechanism can be used to set the interceptor, so that when the network engine processes network requests in parallel, the execution order of specific network requests can be controlled, or preprocessing of specific network requests can be performed.

[0049] The interceptor message in this embodiment of the invention controls the execution order of network requests, preventing subsequent messages from being consumed before the interceptor message has been fully consumed. Network requests preceding the interceptor message are executed first, and after completion, the interceptor message is consumed, followed by the execution of subsequent network requests.

[0050] In some embodiments of the present invention, the preset position can be a position near the front of the message queue, thereby ensuring that the target network request is retrieved first. In some embodiments of the present invention, in order to further ensure execution priority, the preset position can be the front of the message queue, so that it is retrieved and executed first.

[0051] S230: Invoke the network engine to retrieve messages from the message queue and send the network requests in the messages to the background server in parallel.

[0052] In this embodiment of the invention, the network engine 112 retrieves network requests from the messages in the message queue in the order they appear, and sends the network requests to the backend server 120 in parallel, thereby achieving efficient processing of network requests.

[0053] In some embodiments of the present invention, the network engine 112 performs different steps for different types of messages, specifically, such as... Figure 3 As shown, step S230 includes:

[0054] S231: Retrieve messages from the message queue in order from the head to the tail;

[0055] S232: When the message contains a network request, the network engine is invoked to send the network request to the backend server. Based on the correct response returned by the backend server for the network request, the message containing the network request in the message queue is indicated to be consumed.

[0056] S233: When the message is an interceptor message, execute the interceptor logic.

[0057] like Figure 4As shown in this embodiment of the invention, network requests Req1, Req2, and Req3 are inserted into message queue 111 as messages. Each business thread, acting as a producer, inserts messages containing network requests into message queue 111. The network engine 112, acting as a consumer, retrieves the network requests from messages in message queue 111 and sends network requests Req1, Req2, and Req3 to the backend server 120 in parallel. When the network request response status is correct, the message containing the corresponding network request is consumed, and message queue 111 removes the message. For example, when the response status of Req2 is correct, the message containing Req2 is removed. By sending network requests in parallel, the processing efficiency of network requests is ensured, avoiding the problems of long waiting times and poor user experience caused by serial sending.

[0058] In this embodiment of the invention, network engine 112 retrieves network request Req1 and sends it, then retrieves Req2 and sends it, then retrieves Req3 and sends it. Before sending the current network request, it does not concern itself with the execution status of the previous network request, thus achieving parallel sending of network requests Req1, Req2, and Req3. In this embodiment of the invention, although network engine 112 sends network requests in a sequential manner when sending network requests in parallel, the sending interval between adjacent network requests is extremely short, achieving an effect similar to sending network requests simultaneously. Similarly, when sending network requests in parallel, the interval between retrieving messages from the message queue is also extremely short, achieving an effect similar to retrieving network requests from messages in batches. In some comparative embodiments, network engine 112 sends network requests serially, resulting in a decrease in network request processing efficiency, but it can ensure the execution order of each network request. For example, network engine 112 retrieves network request Req1, sends Req1, waits for a response to Req1, then retrieves Req2, sends Req2, waits for a response to Req2, then retrieves Req3 and sends Req3.

[0059] like Figure 5 As shown, in other embodiments of the present invention, network requests Req1, Req2, and Req3 are inserted into message queue 111 as messages. When network request Req3 needs to be executed first, network request Req3, as the target network request, is inserted into a preset position in message queue 111 as a message. An interceptor message Bar is set after the message containing Req3. The interceptor logic in the interceptor message Bar controls that only after Req3 has been processed can the other network requests be processed, thereby ensuring the priority execution order of network request Req3. After the interceptor message is consumed, the network engine 112 processes the network requests in parallel, which can achieve both efficient parallel processing of network requests and processing of network requests in a set order, ensuring both efficiency and flexibility.

[0060] In this embodiment of the invention, setting interceptor messages in the message queue can control the network engine to prevent it from retrieving network requests following the interceptor messages before the interceptor messages have been consumed, thereby controlling the processing order of network requests.

[0061] In some embodiments of the present invention, in order to ensure that higher-priority network requests can be retrieved earlier, network requests are inserted into the message queue in order of priority according to their respective priorities. Specifically, step S220 includes:

[0062] Get the priority of the network requests and insert them into the message queue according to the priority order.

[0063] like Figure 6 As shown, network request Req1 has a priority of 2, network request Req2 has a priority of 1, and network request Req3 has a priority of 3. Therefore, the order in which they are inserted into the message queue is Req2, Req1, and Req3, so that the network engine can retrieve Req2 first for processing.

[0064] In some embodiments of the present invention, the interceptor message can ensure that subsequent network requests are allowed only after the target network request has been completed, thereby ensuring that network requests are executed in a specific order. In some embodiments, the processing steps after the target network request is completed can also be set according to the execution logic in the interceptor logic, which improves the flexibility of program design and facilitates quick verification of the execution status.

[0065] Specifically, the interceptor logic is configured such that the interceptor message is consumed only after the message preceding it has been consumed. The interceptor logic does not have execution logic; it simply allows subsequent network requests to proceed once the message preceding it has been consumed, thus controlling the order of network requests. For example, if the target network request is a request to restore login status, and the other network requests are business processing requests, the business processing requests are only allowed after the login status restoration process is completed.

[0066] In other embodiments of the present invention, the interceptor logic is further configured to: execute the execution logic in the interceptor logic after the message preceding the interceptor message has been consumed; and after the execution logic has been executed, the interceptor message has been consumed. For example, if the target network request is a network request to restore login status, and the other network requests are business processing requests, the execution logic in the interceptor logic is a risk verification request. After restoring login status, risk verification is performed; and after risk verification is completed, business processing is performed.

[0067] In this embodiment of the invention, the execution logic in the interceptor logic can be set as frequently used processing logic or network requests as needed, reducing repetitive program settings and reducing program size.

[0068] In some embodiments of the present invention, different execution logics can be set with different logical identifiers. By setting the identifier in the interceptor message, the corresponding execution logic is indexed from the storage area and called according to the identifier during the execution process.

[0069] In some embodiments of the present invention, to allow for more flexible configuration of the execution logic, the execution logic can be configured as a chained execution logic to complete a series of post-processing procedures. Specifically, the execution logic includes a chained execution logic composed of multiple individual execution logics linked together in execution order, and the execution interceptor logic includes:

[0070] Once the current single execution logic is completed, the next single execution logic will be executed in the execution order until the chain of execution logic is completed.

[0071] For example, such as Figure 7 As shown, after the target network request Req2 is executed, the execution logic Logi_bar in the interceptor message is executed. The execution logic Logi_bar has multiple single execution logics Logi_bar1, Logi_bar2, and Logi_bar3, which are linked in the execution order and executed sequentially. After the execution is completed, the subsequent network requests Req1 and Req3 are executed.

[0072] In some embodiments of the present invention, in order to ensure that the execution logic can be executed successfully, repeated execution can be set according to the execution status. Specifically, when the execution logic includes logic that requests information from the backend server, in response to the failure to obtain information when the execution logic receives the request, the execution logic is inserted into the message queue as a message, and the message corresponding to the execution logic is located before the interceptor message.

[0073] For example, receiving Figure 7 Examples, such as Figure 8 As shown, when Logi_bar3 needs to request information from the backend server, after receiving a failure to obtain information, Logi_bar3 is inserted as a message before the interceptor message Bar. The network engine 112 then retrieves the execution logic of Logi_bar3 from the message queue 111 to obtain the message from the backend server, ensuring that the request to obtain the message is completed.

[0074] In some embodiments of the present invention, an execution state can be set for the execution logic, such as... Figure 8In the example, after Logi_bar3 is executed, the execution status is set to executed. After the network request of Logi_bar3 is completed from the message queue, the network engine 112 determines that the execution status of the execution logic in the interceptor message is executed, and then determines that the interceptor message consumption is complete.

[0075] The method in this embodiment of the invention improves the processing efficiency of network requests by inserting each network request into a message queue, then retrieving network requests from the message queue through a network engine and sending them in parallel. At the same time, interceptor messages are set after the target network requests according to their execution order to ensure the priority of specific network requests and ensure the smooth completion of business processing, thus handling network requests efficiently and flexibly.

[0076] like Figure 9 As shown, this embodiment of the invention also provides a network request control device 300, applied to the front end, which includes a network request acquisition module 310, a message queue management module 320, and a network engine invocation module 330, wherein...

[0077] The network request acquisition module 310 is configured to acquire network requests that the front end is about to send to the backend server;

[0078] The message queue management module 320 is configured to insert network requests into the message queue as messages. When there is a target network request that needs to be executed first in the network request, the target network request is inserted into the preset position of the message queue, and an interceptor message is set after the target network request in the message queue. The interceptor message contains interceptor logic, which is configured so that the message after the interceptor message can only be consumed after the message before the interceptor message has been consumed.

[0079] The network engine invocation module 330 is configured to invoke the network engine to retrieve messages from the message queue in parallel and send the network requests in the messages to the backend server.

[0080] In some embodiments of the present invention, the network engine invocation module 330 is further configured as follows:

[0081] When the message contains a network request, the network engine is invoked to send the network request to the backend server. Based on the correct response returned by the backend server for the network request, the message containing the network request in the message queue is indicated to have been consumed.

[0082] When the message is an interceptor message, the interceptor logic is executed.

[0083] In some embodiments of the present invention, the message queue management module 320 is further configured as follows:

[0084] Get the priority of the network requests and insert them into the message queue according to the priority order.

[0085] In some embodiments of the present invention, the interceptor logic is further configured as follows:

[0086] Once the messages preceding the interceptor message have been consumed, the interceptor message has also been consumed.

[0087] Alternatively, it can be configured such that after the message preceding the interceptor message has been consumed, the execution logic in the interceptor logic is executed, and after the execution logic has been executed, the interceptor message has been consumed.

[0088] In some embodiments of the present invention, the execution logic includes chained execution logic composed of multiple individual execution logics linked together in execution order, and the execution interceptor logic includes:

[0089] Once the current single execution logic is completed, the next single execution logic will be executed in the execution order until the chain of execution logic is completed.

[0090] In some embodiments of the present invention, when the execution logic includes logic for requesting information from a background server, the message queue management module 320 is further configured to: in response to the failure to obtain information received during the execution logic, insert the execution logic into the message queue as a message, with the message corresponding to the execution logic located before the interceptor message.

[0091] In some embodiments of the present invention, the preset position is the front end of the message queue.

[0092] The device features of the embodiments of the present invention can be referred to the features of the methods and steps of the embodiments of the present invention, and the system embodiments can be combined with the features of the method embodiments to obtain new embodiments, and vice versa, and will not be repeated here.

[0093] Figure 10 An exemplary system architecture 1000 is shown that can be applied to the network request control method or network request control implementation apparatus of the present invention.

[0094] like Figure 10 As shown, system architecture 1000 may include terminal devices 1001, 1002, and 1003, network 1004, and server 1005. Network 1004 is used as a medium to provide communication links between terminal devices 1001, 1002, and 1003 and server 1005. Network 1004 may include various connection types, such as wired or wireless communication links or fiber optic cables, etc.

[0095] Users can use terminal devices 1001, 1002, and 1003 to interact with server 1005 via network 1004 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1001, 1002, and 1003, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0096] Terminal devices 1001, 1002, and 1003 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0097] Server 1005 can be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 1001, 1002, and 1003 (for example only). The backend management server can analyze and process data such as received product information query requests, and feed back the processing results (such as target push information, product information - for example only) to the terminal devices.

[0098] It should be noted that the network request control method provided in the embodiments of the present invention is generally executed by terminal devices 1001, 1002, and 1003, and correspondingly, the network request control implementation device is generally disposed in terminal devices 1001, 1002, and 1003.

[0099] It should be understood that Figure 10 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0100] The following is for reference. Figure 11 It shows a schematic diagram of the structure of a computer system 1100 suitable for implementing terminal devices or servers of the present invention. The methods or apparatus for implementing the methods in the embodiments of the present invention can be implemented on the computer system 1100. Figure 11 The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0101] like Figure 11As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1102 or programs loaded from storage section 1108 into random access memory (RAM) 1103. The RAM 1103 also stores various programs and data required for the operation of the system 1100. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0102] The following components are connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1110 as needed so that computer programs read from them can be installed into storage section 1108 as needed.

[0103] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit (CPU) 1101, it performs the functions defined above in the system of this invention.

[0104] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0106] The units or modules described in the embodiments of the present invention can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor can be described as including a sending unit (or "module"), an acquisition unit, a determining unit, and a first processing unit. The names of these units or modules do not necessarily limit the specific unit or module itself; for example, a sending unit can also be described as "a unit that sends an image acquisition request to a connected server."

[0107] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs that, when executed by the device, cause the device to perform the methods described above.

[0108] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A network request control method, characterized in that, When applied to the front end, the method includes the following steps: Obtain the network request that the front end is about to send to the backend server; The network request is inserted into the message queue as a message. When there is a target network request that needs to be executed first in the network request, the target network request is inserted into a preset position in the message queue, and an interceptor message is set after the target network request in the message queue. The interceptor message contains interceptor logic, which is configured to control that the interceptor message can only be consumed after the message before the interceptor message has been consumed. The network engine is invoked to retrieve messages from the message queue and send the network requests contained in the messages to the backend server in parallel.

2. The method according to claim 1, characterized in that, The step of invoking the network engine to retrieve messages from the message queue in parallel and sending the network requests in the messages to the backend server includes: When the message contains a network request, the network engine is invoked to send the network request to the backend server. Based on the correct response returned by the backend server for the network request, the message queue containing the network request is instructed to be consumed. When the message is an interceptor message, the interceptor logic is executed.

3. The method according to claim 2, characterized in that, Inserting the network request into the message queue as a message includes: Obtain the priority of the network request, and insert the network request into the message queue according to the priority order.

4. The method according to claim 1, characterized in that, The interceptor logic is also configured as follows: Once the messages preceding the interceptor message have been consumed, the interceptor message has also been consumed. Alternatively, it can be configured such that after the message preceding the interceptor message has been consumed, the execution logic in the interceptor logic is executed, and after the execution logic has been executed, the interceptor message has been consumed.

5. The method according to claim 4, characterized in that, The execution logic includes a chained execution logic composed of multiple individual execution logics linked together in execution order, and the execution of the interceptor logic includes: Once the current single execution logic is completed, the next single execution logic will be executed in the execution order until the chain of execution logic is completed.

6. The method according to claim 4, characterized in that, When the execution logic includes logic that requests information from the backend server, in response to a failure to obtain information during the execution of the execution logic, the execution logic is inserted into the message queue as a message, with the message corresponding to the execution logic preceding the interceptor message.

7. The method according to claim 1, characterized in that, The preset position is the very front of the message queue.

8. A network request control device, characterized in that, Applied to the front end, it includes a network request retrieval module, a message queue management module, and a network engine invocation module, among which, The network request acquisition module is configured to acquire the network requests that the front end is about to send to the backend server. The message queue management module is configured to insert the network request into the message queue as a message. When there is a target network request that needs to be executed first in the network request, the target network request is inserted into a preset position in the message queue, and an interceptor message is set after the target network request in the message queue. The interceptor message contains interceptor logic, and the interceptor logic is configured to control that the interceptor message can only be consumed after the message before the interceptor message has been consumed. The network engine invocation module is configured to invoke the network engine to retrieve messages from the message queue in parallel and send the network requests in the messages to the backend server.

9. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.

10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.