CN114885025A - Asynchronous request processing method, device, equipment and storage medium - Google Patents

Asynchronous request processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN114885025A
CN114885025A CN202210674082.2A CN202210674082A CN114885025A CN 114885025 A CN114885025 A CN 114885025A CN 202210674082 A CN202210674082 A CN 202210674082A CN 114885025 A CN114885025 A CN 114885025A
Authority
CN
China
Prior art keywords
asynchronous
requests
request
asynchronous request
request processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210674082.2A
Other languages
Chinese (zh)
Other versions
CN114885025B (en
Inventor
何中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202210674082.2A priority Critical patent/CN114885025B/en
Publication of CN114885025A publication Critical patent/CN114885025A/en
Application granted granted Critical
Publication of CN114885025B publication Critical patent/CN114885025B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The disclosure provides an asynchronous request processing method, an asynchronous request processing device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps of receiving a plurality of asynchronous requests, wherein the asynchronous requests comprise asynchronous identifications; recording the plurality of asynchronous requests and collecting processing functions of the asynchronous requests; detecting the completion condition of the asynchronous interaction actions of the plurality of asynchronous requests in real time; and after the asynchronous interaction of the asynchronous requests is finished, executing corresponding processing callbacks on the asynchronous requests. According to the technical scheme, a rendering mechanism does not need to be frequently called when a large number of asynchronous requests are processed, and the problems of blocking and performance loss caused by frequently refreshing the page are solved.

Description

Asynchronous request processing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an asynchronous request processing method and apparatus, an electronic device, and a computer-readable storage medium.
Background
Under the architecture mode that the client side and the server side are separated, the task of rendering the page by the background is released, and more rendering functions are placed on the client side. In order to realize a certain function, the client needs to send a plurality of asynchronous requests to the server, so that the number of asynchronous requests in a page is large, a rendering mechanism is frequently called, and the performance is wasted.
Therefore, users need a new processing method in the face of large-scale, high-performance asynchronous requests. When a large number of asynchronous requests are processed, a rendering mechanism needs to be called frequently, and frequent refreshing of pages causes unsmooth performance loss.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides an asynchronous request processing method, apparatus, device and storage medium, which at least to some extent implements an efficient and low-consumption asynchronous request processing scheme.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, there is provided an asynchronous request processing method, including:
intercepting a plurality of asynchronous requests with asynchronous identifications;
caching the plurality of asynchronous requests with asynchronous identifications;
detecting the completion condition of the asynchronous interaction actions of the plurality of asynchronous requests in real time;
and after the asynchronous interaction of the asynchronous requests is finished, executing corresponding processing callbacks on the asynchronous requests.
In one embodiment of the present disclosure, the step of intercepting a plurality of asynchronous requests with asynchronous identifications includes:
receiving an asynchronous request;
judging whether the asynchronous request carries an asynchronous identifier or not;
intercepting the asynchronous request with the asynchronous identifier.
In an embodiment of the present disclosure, the step of detecting the completion of the asynchronous interaction of the plurality of asynchronous requests in real time includes:
acquiring a queue of the plurality of asynchronous requests;
judging whether the asynchronous request in the queue is responded in real time;
determining that the asynchronous interactions of the plurality of asynchronous requests are complete when all of the asynchronous requests in the queue are responded to.
In an embodiment of the present disclosure, the step of executing corresponding processing callbacks on the plurality of asynchronous requests after the asynchronous interaction of the plurality of asynchronous requests is completed includes:
and after the asynchronous interaction actions of the asynchronous requests are completed, executing callback functions corresponding to the asynchronous requests in batches to generate processing data.
In one embodiment of the present disclosure, the asynchronous identification is point-in-time information of the asynchronous request.
In an embodiment of the present disclosure, after the step of executing the corresponding processing callbacks on the plurality of asynchronous requests, the method further includes:
refreshing the page data requested by the plurality of asynchronous requests.
According to another aspect of the present disclosure, there is provided an asynchronous request processing apparatus, including:
the intercepting module is used for intercepting a plurality of asynchronous requests with asynchronous identifications;
the cache module is used for caching the plurality of asynchronous requests with asynchronous identifications;
the detection module is used for detecting the asynchronous interaction completion condition of the plurality of asynchronous requests in real time;
and the callback module is used for executing corresponding processing callbacks on the asynchronous requests after the asynchronous interaction actions of the asynchronous requests are finished.
In an embodiment of the present disclosure, the asynchronous request processing apparatus is characterized in that the detection module includes:
an obtaining module, configured to obtain the queues of the multiple asynchronous requests;
the judging module is used for judging whether the asynchronous request in the queue is responded in real time;
a determining module for determining that the asynchronous interaction of the plurality of asynchronous requests is complete when all of the asynchronous requests in the queue are responded to.
According to still another aspect of the present disclosure, there is provided an asynchronous request processing apparatus including:
at least one processor and a memory communicatively coupled to the at least one processor; the memory stores commands executable by the at least one processor to enable the at least one processor to perform an asynchronous request processing method as described in the first aspect above.
According to yet another aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements an asynchronous request processing method as described above in the first aspect.
According to yet another aspect of the present disclosure, there is provided a computer program product comprising a computer program stored on a computer readable storage medium, the computer program comprising program instructions which, when executed by a processor, cause the processor to perform an asynchronous request processing method as described in the first aspect above.
The asynchronous request processing method provided by the embodiment of the disclosure can respond to asynchronous requests in time-sharing and batch mode by setting the asynchronous identifier for the asynchronous requests, and avoids a lot of unnecessary view refreshing in a large amount of data interaction. Compared with the technical scheme in the prior art, the technical scheme disclosed by the invention can process a large amount of asynchronous requests without frequently calling a rendering mechanism, and the problems of blocking and performance loss caused by frequent refreshing in a page are solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 is a schematic application scenario diagram of an asynchronous request processing method according to an exemplary embodiment of the present disclosure;
FIG. 2 is a flowchart of an asynchronous request processing method provided by an exemplary embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating asynchronous identification of a performance request of an asynchronous request processing method according to an exemplary embodiment of the present disclosure;
FIG. 4 is a diagram illustrating an intercepted asynchronous request processing method according to an exemplary embodiment of the disclosure;
FIG. 5 is a schematic diagram of an asynchronous request processing apparatus according to an exemplary embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a detection module in an asynchronous request processing apparatus according to an exemplary embodiment of the present disclosure;
fig. 7 is a schematic diagram of an asynchronous request processing electronic device according to an exemplary embodiment of the disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
According to the scheme, the performance data can be acquired in a high-efficiency low-cost multi-mode, the management and control system selects the most applicable performance data acquisition mode according to the application layer requirements and the actual equipment capacity, and the performance data acquisition mode can be dynamically adjusted according to the equipment load condition.
The scheme provided by the embodiment of the present disclosure relates to asynchronous request processing and other technologies in the technical field of network communication, and is specifically described by the following embodiments:
fig. 1 is a schematic application scenario diagram of an asynchronous request processing method according to an exemplary embodiment of the present disclosure.
The client device 110 is communicatively connected to the server device 120 via the network 130, wherein the server device 120 may be a device running a server program, and the device may be, for example, a server or one of a cluster of servers. Client device 120 may be a device, such as a smartphone, personal computer, etc., running a client program. The client program may be an Application program (APP) that communicates with the server program.
Fig. 2 is a flowchart of an asynchronous request processing method according to an exemplary embodiment of the present disclosure, where the asynchronous request processing method includes:
s201, intercepting a plurality of asynchronous requests with asynchronous identifications;
the server device 120 may receive the asynchronous request sent by the client device 110 and intercept the asynchronous request with the asynchronous identification therein.
The asynchronous request is that the client gives a request to a proxy object, such as an XMLHttpRequest (browser object request), the proxy object initiates the request to the server, receives and analyzes data responded by the server, and updates the data to a control specified by the client, so that local or overall refreshing of page data is realized. The asynchronous request enables the client to display the data responded by the server without waiting for the server to respond to the request or reloading the whole page, and the client can also perform other operations in the sending process of the asynchronous request.
The asynchronous request is mainly characterized in that the page display can be unchanged in the starting and proceeding processes of acquiring data; after the data is acquired, a specific display logic is operated according to the data to enable the interface of the webpage to be refreshed partially or wholly.
The asynchronous identification is an identification used to determine whether a request is an asynchronous request or a synchronous request. The asynchronous flag is preset so that the corresponding asynchronous request can be easily found when access control is performed. The asynchronous identifier may be any character, and each asynchronous request requiring a unified callback may have the same asynchronous identifier. For example, in a web browsing scenario, the client device 110 is used to view a web page, the server device 120 is used to provide a web page refreshing service, the client device 110 needs to obtain a refreshing page P from the server device 120, the refreshing page P includes a plurality of data, and the client device 100 typically sends a plurality of asynchronous requests to respectively obtain the plurality of data. The multiple asynchronous requests respectively used for obtaining multiple types of data of the same refresh page P all have the page identifier of the refresh page P, and optionally, the page identifier may be a page ID (Identity) of the refresh page P, or may also be a Uniform Resource Locator (URL) address of the refresh page P, which is not limited in this embodiment. Based on this, in implementation, the client device 110 may identify the asynchronous identifier in each asynchronous request, and determine the asynchronous request with the same asynchronous identifier as the asynchronous request requiring the unified callback.
The key point of the asynchronous request is the XMLHttpRequest object. The methods by which different client devices create XMLHttpRequest objects differ. The IE browser uses ActiveXObject, while the other browsers use JavaScript built-in objects named XMLHttpRequest. If this object is to be created for a different client device, we use a "try and catch" statement. The following examples:
Figure BDA0003694178310000061
Figure BDA0003694178310000071
when an XMLHttpRequest object is created, the object needs to be set, and the specific steps are as follows:
(1) setting request parameters (request mode, relative path of request page, with asynchronous identification or not)
(2) Setting callback function, a function for handling server responses, using onreadystatechange, like function pointers, e.g.
Figure BDA0003694178310000072
(3) Acquiring the readyState attribute of the asynchronous object: the attribute stores state information of the server response. The onreadystatechange function is executed whenever the readyState changes.
Possible values for the readyState attribute:
request 0 is not initialized (before open () is called)
1 request has been made (before calling send ())
2 request sent (where the content header is typically available from the response)
3 in request processing (partial data is usually available in response, but the server has not finished the response yet)
4 request completed (can access server response and use it)
At call time, we add an If statement to this onreadystatechange function to test If our response is complete (meaning data is available):
Figure BDA0003694178310000081
(4) and judging the state of the response message, if the state is 200, indicating that the server side normally operates, and returning response data.
(5) And reading the response data, and retrieving the data returned by the server side through a responseText attribute.
Figure BDA0003694178310000082
Examples are as follows:
Figure BDA0003694178310000083
Figure BDA0003694178310000091
s202, caching the asynchronous requests with the asynchronous identifications;
the server device 120 caches the intercepted asynchronous request with the asynchronous identification.
The server device 120 may buffer at least one asynchronous request message into a predetermined memory queue pool. The memory queue pool is used for storing a plurality of asynchronous request messages, the asynchronous request messages are provided with asynchronous identifiers, and the asynchronous request messages are arranged in a certain sequence.
The server device 120 may extract the asynchronous request information from the memory queue pool in order to process the asynchronous request, and execute the extracted asynchronous request information. The client device 110 may send an asynchronous request to the server device 120, and then receive various contents sent by the server device 120 for the asynchronous request. The server device 120 may sequentially extract the asynchronous request messages according to the arrangement order of the asynchronous request messages in the memory queue pool. The server device 120 may simultaneously extract at least one asynchronous request message for processing. As an example, assuming that the preset number is N, the N parallel request processing threads may fetch asynchronous requests from the memory queue pool in parallel in order. And after a certain thread executes an asynchronous request, continuously extracting asynchronous request information from the memory queue pool according to the sequence to process the asynchronous request. In the implementation manner, by setting a preset number of parallel request processing threads, the server device 120 can process a plurality of asynchronous request information in parallel, so as to accelerate the speed of processing the asynchronous request information.
S203, detecting the completion condition of the asynchronous interaction of the plurality of asynchronous requests in real time;
in an exemplary embodiment of the present disclosure, the server device 120 may read the quantity value of the asynchronous request information in the memory queue pool in real time, and when the quantity value of the asynchronous request information is zero, it indicates that all the asynchronous requests corresponding to the current page have been responded by the server device 120, and the asynchronous interaction of the multiple asynchronous requests of the current page has been completed.
In one exemplary embodiment of the present disclosure, the record value of an asynchronous request is set according to the response condition of the asynchronous request. Sequentially accessing the recorded value of each asynchronous request, and judging whether the recorded value of the current access asynchronous request is a target value; if the recorded value of the asynchronous request is the target value, it is determined that the asynchronous request is responded by the server device 120; and if the recorded value of the asynchronous request is not the target value, determining that the asynchronous request is not responded by the server-side equipment currently.
For example, the server device 120 may set the record value of an asynchronous request to 1 when processing of the asynchronous request is completed and the asynchronous request is responded to. The record value of an unresponsive asynchronous request remains 0. In this case, if the client device 110 determines that the record value of an asynchronous request is 1, it indicates that the asynchronous request has been responded by the server device 120, and if the client device 110 determines that the record value of an asynchronous request is not 1, for example, 0, it indicates that the asynchronous request is not currently responded by the server device 200. As such, the client device 110 may determine whether each asynchronous request has been responded to by the server device 120 according to whether the recorded value of the asynchronous request is 1. The client device 110 sequentially accesses the recorded value of each asynchronous request, and when the recorded value of each asynchronous request is 1, it indicates that the asynchronous interaction has been completed.
S204, after the asynchronous interaction of the asynchronous requests is completed, corresponding processing callbacks are executed on the asynchronous requests.
When the execution content of the asynchronous request is determined, the server device 120 executes the processing request of the asynchronous request. For example, when an asynchronous request needs to operate on data (which may include operations such as adding data, deleting data, modifying data, and querying data), a corresponding data operation request may be generated and sent to the server device 120, so that the server device 120 responds, where the data operation request may carry information such as a request address, an authentication character, and a request identifier.
The server device 120 determines whether the asynchronous request in the queue is responded by reading the queue information of the asynchronous request in the buffer. And if the asynchronous request is already responded, the asynchronous request is moved out of the queue, and when the queue is empty, the asynchronous request is indicated to be completely responded, and the asynchronous interaction of the plurality of asynchronous requests is judged to be completed.
The device unique identifier may be unique identification information of the target node, and the Internet Protocol address (IP) is a network layer Protocol in a TCP/IP system. Providing a datagram delivery service to the host.
When the server device 120 detects that all the interaction actions of the asynchronous requests with the asynchronous identifiers are completed, the corresponding processing functions are uniformly executed to obtain corresponding data, the data is returned to the client, and at this time, the client device 110 completes rendering according to the obtained data and refreshes a page.
Fig. 3 is a schematic diagram of asynchronous identification of a performance request of an asynchronous request processing method according to an exemplary embodiment of the present disclosure.
An asynchronous identification is an identification used to determine whether an asynchronous request or a synchronous request is made at a request. The asynchronous flag is preset so that the corresponding asynchronous request can be successfully found when access control is performed. The asynchronous identifier may be any character, and each asynchronous request requiring a unified callback usually carries the same asynchronous identifier. The asynchronization of the asynchronous request 300 is identified as a point-in-time information code. The server device 120 may read the asynchronous identifier with the time point information in the asynchronous request, further determine the time when the asynchronous request is received, and sequence the corresponding asynchronous requests according to the time when the asynchronous request is received.
When the client device 110 sets the asynchronous request, a time point information code may be added to the asynchronous request, and the server device 120 may set priority weights corresponding to the asynchronous request information in the memory queue pool by reading the time point information code, that is, the response times of the asynchronous requests are sorted by the time point information. The time point information is used to indicate the priority of the asynchronous request information processed by the server device 120. As an example, the priority weight may be time point information indicating that the higher the priority level, the higher the time point information is. Asynchronous request information with high priority may be ranked first (i.e., prioritized) and asynchronous request information with low priority may be ranked later. The priority weights may be manually set in advance or may be automatically set by the client device 110 or the server device 120 according to the type of asynchronous request.
In the mode in an exemplary embodiment of the present disclosure, by setting the priority weight, it may be implemented to adjust the asynchronous request with high priority to the front end of the queue, that is, to preferentially deliver the asynchronous request with high priority to the server device 120 for execution, so that some more important asynchronous request information may be preferentially executed, and the pertinence of the execution request is improved.
In some optional implementations in an exemplary embodiment of the present disclosure, the client device 110 or the server device 120 may set a priority weight to the asynchronous request information in the memory queue pool according to a preset sorting period. That is, each time, the execution main body resets the priority weight of the asynchronous request in the memory queue pool, and further sequences the asynchronous request in the memory queue pool according to the reset priority weight, thereby implementing real-time adjustment of the priority of the asynchronous request and improving the pertinence of the server device 120 in dynamically executing the asynchronous request.
Fig. 4 is a schematic diagram of an intercepted asynchronous request processing method according to an exemplary embodiment of the present disclosure, including:
s401, receiving an asynchronous request. The server device 120 may receive the asynchronous request sent by the client device 110.
S402, judging whether the asynchronous request has an asynchronous identifier. After receiving the asynchronous request, the server device 120 reads the content of the asynchronous request and determines whether the asynchronous request has an asynchronous identifier.
S403, intercepting the asynchronous request with the asynchronous identifier. And if the asynchronous request carries an asynchronous identifier, intercepting the asynchronous request.
S404, if the asynchronous request does not contain the asynchronous identification, the asynchronous request is not intercepted.
By the method, whether the asynchronous request needs to be intercepted or not can be judged quickly and accurately, and a large number of asynchronous requests can be processed in a targeted mode without frequently calling a rendering mechanism.
Fig. 5 is an asynchronous request processing apparatus according to an exemplary embodiment of the present disclosure, in the asynchronous request processing apparatus 500, the following modules are included, but not limited to: an interception module 510, a caching module 520, a detection module 530, and a callback module 540.
Wherein, the intercepting module 510 is configured to intercept a plurality of asynchronous requests with asynchronous identifications.
The server device 120 may receive the asynchronous request sent by the client device 110 and intercept the asynchronous request with the asynchronous identifier therein through the interception module 510 therein.
A caching module 520, configured to cache the plurality of asynchronous requests with asynchronous identifications;
the server device 120 caches the intercepted asynchronous request with the asynchronous identifier, and sets a record value of the asynchronous request according to a response condition of the asynchronous request.
A detecting module 530, configured to detect, in real time, the asynchronous interaction completion condition of the multiple asynchronous requests;
sequentially detecting the recorded value of each asynchronous request, and judging whether the recorded value of the current asynchronous request is a target value; if the record value of the asynchronous request is the target value, determining that the asynchronous request is responded by the server-side equipment; and if the recorded value of the asynchronous request is not the target value, determining that the asynchronous request is not responded by the server-side equipment currently. And sequentially detecting the recorded value of each asynchronous request, and when the recorded value of each asynchronous request is 1, indicating that the asynchronous interaction is completed.
Sequentially detecting whether each asynchronous request is responded by the server equipment or not aiming at each asynchronous request which is sent to the server equipment and needs to be uniformly recalled; if the asynchronous request detected currently is determined to be responded by the server-side equipment, detecting whether the next asynchronous request is responded by the server-side equipment; if the asynchronous request detected currently is not responded by the server-side equipment currently, waiting for the server-side equipment to respond to the asynchronous request, and detecting whether the next asynchronous request is responded by the server-side equipment or not when the asynchronous request detected currently is determined to be responded by the server-side equipment.
The callback module 540 is configured to execute a corresponding processing callback for the asynchronous request, and may specifically be configured to refresh page data requested by each asynchronous request.
When all the interaction actions of the asynchronous requests with the asynchronous identifications are finished, the callback module uniformly executes corresponding processing functions to obtain corresponding data and returns the data to the client, and at the moment, the client finishes rendering and refreshes the page according to the obtained data.
Preferably, the asynchronous request processing device 500 may further include a storage module 550, configured to store various types of data, and may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The storage module 550 may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The storage module 550 may include a storage program area and a storage data area, wherein the storage program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like. The storage data area may also store data (record values, etc.) created by the client device 100 in use, and the like.
Optionally, the asynchronous request processing apparatus 500 may further include a control module 560 for controlling operations of the intercepting module 510, the caching module 520, the detecting module 530, the callback module 540, and the storing module 550.
In the exemplary embodiments provided in the present disclosure, the coupling or direct coupling or communication connection between the modules shown or discussed may be through some interfaces, the indirect coupling or communication connection of devices or modules, and may be in an electrical, mechanical or other form.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
It should be noted that, since an asynchronous request processing apparatus in this embodiment is based on the same inventive concept as an asynchronous request processing method in any of the above embodiments, the corresponding contents in the method embodiments are also applicable to the system embodiments, and detailed descriptions thereof are omitted here.
Fig. 6 is a schematic diagram of a detection module 600 in an asynchronous request processing apparatus according to an exemplary embodiment of the present disclosure, which includes but is not limited to the following modules: an obtaining module 610, a judging module 620 and a judging module 630.
The obtaining module 610 is configured to obtain a queue of the multiple asynchronous requests;
a determining module 620, configured to determine whether the asynchronous request in the queue is responded in real time;
a determining module 630, configured to determine that the asynchronous interaction of the plurality of asynchronous requests is completed when all of the asynchronous requests in the queue are responded to.
The server device 120 determines whether the asynchronous request in the queue is responded by reading the queue information of the asynchronous request in the buffer. And if the asynchronous request is already responded, the asynchronous request is moved out of the queue, and when the queue is empty, the asynchronous request is indicated to be completely responded, and the asynchronous interaction of the plurality of asynchronous requests is judged to be completed.
Fig. 7 illustrates an asynchronous request processing device according to an exemplary embodiment of the present disclosure, where the asynchronous request processing device 700 may be any type of terminal, such as a mobile phone, a game console, a tablet Computer, an electronic book reader, smart glasses, a mobile terminal such as a MP4(moving picture Experts Group Audio Layer IV) player, a smart home device, an AR (Augmented Reality) device, a VR (Virtual Reality) device, or a reconfigurable smart surface assisted asynchronous request processing device 700 may also be a Personal Computer (Personal Computer, PC), a mobile phone such as a laptop Computer and a desktop Computer, a tablet Computer, a Personal Computer, or the like.
Among them, the asynchronous request processing apparatus 700 may be installed with an application program for providing an asynchronous request processing method.
Preferably, the asynchronous request processing device 700 comprises: one or more processors 710 and memory 720, one processor 710 being illustrated in FIG. 7.
The processor 710 and the memory 720 may be connected by a bus or other means, and fig. 7 illustrates a connection by a bus as an example.
The memory 720, which is a non-transitory computer-readable storage medium, may be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions/modules corresponding to the reconfigurable intelligent surface assisted asynchronous request processing device 700 in the embodiment of the present invention, for example, the intercepting module 510, the caching module 520, the detecting module 530, and the callback module 540 shown in fig. 5. The processor 710 executes various functional applications and data processing of the reconfigurable intelligent surface assisted asynchronous request processing device 500 by executing non-transitory software programs, instructions and modules stored in the memory 720, namely, implements an asynchronous request processing method of the above-described method embodiments.
The memory 720 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of an asynchronous request processing device 500, and the like. Further, the memory 720 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 720 optionally includes memory located remotely from processor 710, and these remote memories may be connected to the reconfigurable intelligent surface assisted asynchronous request processing device 700 via a network.
Alternatively, the network connection may be a wireless network or a wired network using standard communication techniques and/or protocols. The Network is typically the Internet, but may be any Network including, but not limited to, a Local Area Network (LAN), a Metropolitan Area Network (MAN), a Wide Area Network (WAN), a mobile, wireline or wireless Network, a private Network, or any combination of virtual private networks. In some embodiments, data exchanged over a network is represented using techniques and/or formats including Hypertext Mark-up Language (HTML), Extensible markup Language (XML), and the like. All or some of the links may also be encrypted using conventional encryption techniques such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet protocol Security (IPsec). In other embodiments, custom and/or dedicated data communication techniques may also be used in place of, or in addition to, the data communication techniques described above.
The one or more units are stored in the memory 720 and when executed by the one or more processors 710 perform an asynchronous request processing method of any of the above method embodiments. For example, the above-described method steps S201 to S204 in fig. 2 and the method steps S401 to S403 in fig. 4 are executed to implement the functions of the module 510 and 560 in fig. 5 and the functions of the module 610 and 630 in fig. 6.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Embodiments of the present invention further provide a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, which are executed by one or more processors, for example, by one processor 710 in fig. 7, and can cause the one or more processors 710 to execute an asynchronous request processing method in the above method embodiments, for example, execute the above-described method steps S201 to S204 in fig. 2, and the method steps S401 to S403 in fig. 4, to implement the functions of the module 510 and 560 in fig. 5, and implement the functions of the module 610 and 630 in fig. 6.
Embodiments of the present invention further provide a computer program product, where the computer program product includes a computer program stored on a computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed by a computer and executed by a processor 710 in fig. 7, the processor 710 can be caused to execute an asynchronous request processing method in the method embodiments, for example, execute the method steps S201 to S204 in fig. 2 and the method steps S401 to S403 in fig. 4 described above, implement the functions of the module 510 and 560 in fig. 5, and implement the functions of the module 610 and 630 in fig. 6.
A program product for implementing the above method according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Optionally, the clients of the applications installed in different devices 700 are the same, or the clients of the applications installed on both devices 700 are clients of the same type of application of different control system platforms. Based on different terminal platforms, the specific form of the client of the application program may also be different, for example, the client of the application program may be a mobile phone client, a PC client, or a World Wide Web (Web) client.
One skilled in the art will appreciate that the number of devices 700 described above may be greater or fewer. For example, the number of the terminals may be only one, or several tens or hundreds of the terminals, or more. The number of terminals and the type of the device are not limited in the embodiments of the present disclosure.
It is to be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the method according to an exemplary embodiment of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects may be collectively referred to herein as a "circuit," "module," or "system.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. An asynchronous request processing method, comprising:
intercepting a plurality of asynchronous requests with asynchronous identifications;
caching the plurality of asynchronous requests with asynchronous identifications;
detecting the completion condition of the asynchronous interaction actions of the plurality of asynchronous requests in real time;
and after the asynchronous interaction of the asynchronous requests is finished, executing corresponding processing callbacks on the asynchronous requests.
2. The asynchronous request processing method of claim 1, wherein the step of intercepting a plurality of asynchronous requests with asynchronous identification comprises:
receiving an asynchronous request;
judging whether the asynchronous request carries an asynchronous identifier or not;
intercepting the asynchronous request with the asynchronous identifier.
3. The asynchronous request processing method of claim 1, wherein the step of detecting the completion of the asynchronous interaction of the plurality of asynchronous requests in real time comprises:
acquiring a queue of the plurality of asynchronous requests;
judging whether the asynchronous request in the queue is responded in real time;
determining that the asynchronous interactions of the plurality of asynchronous requests are complete when all of the asynchronous requests in the queue are responded to.
4. The asynchronous request processing method of claim 1, wherein the step of performing corresponding processing callbacks on the plurality of asynchronous requests after the asynchronous interactions of the plurality of asynchronous requests are completed comprises:
and after the asynchronous interaction actions of the plurality of asynchronous requests are completed, executing callback functions corresponding to the plurality of asynchronous requests in batches to generate processing data.
5. The asynchronous request processing method of claim 1, wherein the asynchronous identification is point-in-time information of the asynchronous request.
6. The asynchronous request processing method of claim 1, further comprising, after the step of performing corresponding processing callbacks on the plurality of asynchronous requests:
refreshing the page data requested by the plurality of asynchronous requests.
7. An asynchronous request processing device, comprising the following modules:
the intercepting module is used for intercepting a plurality of asynchronous requests with asynchronous identifications;
the cache module is used for caching the plurality of asynchronous requests with the asynchronous identifications;
the detection module is used for detecting the asynchronous interaction completion condition of the plurality of asynchronous requests in real time;
and the callback module is used for executing corresponding processing callbacks on the asynchronous requests after the asynchronous interaction actions of the asynchronous requests are finished.
8. The asynchronous request processing device of claim 7, wherein the detection module comprises:
an obtaining module, configured to obtain the queues of the multiple asynchronous requests;
the judging module is used for judging whether the asynchronous request in the queue is responded in real time;
a determining module for determining that the asynchronous interaction of the plurality of asynchronous requests is complete when all of the asynchronous requests in the queue are responded to.
9. An asynchronous request processing electronic device, comprising: at least one processor and a memory communicatively coupled to the at least one processor; the memory stores commands executable by the at least one processor to enable the at least one processor to perform an asynchronous request processing method as claimed in any one of claims 1 to 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out an asynchronous request processing method according to any one of claims 1 to 6.
CN202210674082.2A 2022-06-14 2022-06-14 Asynchronous request processing method, device, equipment and storage medium Active CN114885025B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210674082.2A CN114885025B (en) 2022-06-14 2022-06-14 Asynchronous request processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210674082.2A CN114885025B (en) 2022-06-14 2022-06-14 Asynchronous request processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114885025A true CN114885025A (en) 2022-08-09
CN114885025B CN114885025B (en) 2023-10-03

Family

ID=82682072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210674082.2A Active CN114885025B (en) 2022-06-14 2022-06-14 Asynchronous request processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114885025B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130086154A1 (en) * 2011-09-30 2013-04-04 Oracle International Corporation System and method for providing asynchrony in web services
CN104932932A (en) * 2014-03-20 2015-09-23 腾讯科技(深圳)有限公司 Asynchronous business processing method, device and system
CN105099989A (en) * 2014-04-24 2015-11-25 阿里巴巴集团控股有限公司 Service request processing and service processing result acquiring method, device and system
US20160026504A1 (en) * 2014-07-24 2016-01-28 Home Box Office, Inc. Asynchronous dispatcher for application framework
CN106034137A (en) * 2015-03-09 2016-10-19 阿里巴巴集团控股有限公司 Intelligent scheduling method for distributed system, and distributed service system
CN107547421A (en) * 2017-05-24 2018-01-05 新华三技术有限公司 Asynchronous communication method and device
CN110995817A (en) * 2019-11-27 2020-04-10 广州华多网络科技有限公司 Request callback method and device and client equipment
CN111782996A (en) * 2020-05-29 2020-10-16 厦门市美亚柏科信息股份有限公司 Asynchronous request processing method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130086154A1 (en) * 2011-09-30 2013-04-04 Oracle International Corporation System and method for providing asynchrony in web services
CN104932932A (en) * 2014-03-20 2015-09-23 腾讯科技(深圳)有限公司 Asynchronous business processing method, device and system
CN105099989A (en) * 2014-04-24 2015-11-25 阿里巴巴集团控股有限公司 Service request processing and service processing result acquiring method, device and system
US20160026504A1 (en) * 2014-07-24 2016-01-28 Home Box Office, Inc. Asynchronous dispatcher for application framework
CN106034137A (en) * 2015-03-09 2016-10-19 阿里巴巴集团控股有限公司 Intelligent scheduling method for distributed system, and distributed service system
CN107547421A (en) * 2017-05-24 2018-01-05 新华三技术有限公司 Asynchronous communication method and device
CN110995817A (en) * 2019-11-27 2020-04-10 广州华多网络科技有限公司 Request callback method and device and client equipment
CN111782996A (en) * 2020-05-29 2020-10-16 厦门市美亚柏科信息股份有限公司 Asynchronous request processing method and device

Also Published As

Publication number Publication date
CN114885025B (en) 2023-10-03

Similar Documents

Publication Publication Date Title
US9606703B2 (en) Techniques for detecting inactive browser windows
US9225617B2 (en) Techniques for detecting new browser windows
CN110262807B (en) Cluster creation progress log acquisition system, method and device
US8245125B1 (en) Hybrid rendering for webpages
US9088462B2 (en) Common web accessible data store for client side page processing
EP3866030A1 (en) Webpage loading method, intermediate server, and webpage loading system
WO2015074459A1 (en) Method and apparatus for opening webpage, invoking client, and creating light app
US10284670B1 (en) Network-controlled device management session
KR101974625B1 (en) Methods, systems, and media for detecting the presence of a digital media device on a network
US20160359989A1 (en) Recording And Triggering Web And Native Mobile Application Events With Mapped Data Fields
CN113010818A (en) Access current limiting method and device, electronic equipment and storage medium
US9648078B2 (en) Identifying a browser for rendering an electronic document
US20150012608A1 (en) Web content prefetch control device, web content prefetch control program, and web content prefetch control method
CN108600377B (en) Method, device, terminal and storage medium for suspending file downloading
US20170155741A1 (en) Server, method, and system for providing service data
US20140237296A1 (en) Architecture for remote access to content state
WO2017206893A1 (en) Interface refresh synchronization method and apparatus, terminal, and storage medium
CN111431767A (en) Multi-browser resource synchronization method and device, computer equipment and storage medium
US9160804B2 (en) Web storage optimization
CN114885025B (en) Asynchronous request processing method, device, equipment and storage medium
US10133442B2 (en) Method and apparatus for accessing a chat room
US10742639B1 (en) System and method for improving login and registration efficiency to network-accessed data
US20190227815A1 (en) Preemptive loading of code dependencies for improved performance
US9602594B2 (en) Processing requests
CN110858238A (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20220809

Assignee: Tianyiyun Technology Co.,Ltd.

Assignor: CHINA TELECOM Corp.,Ltd.

Contract record no.: X2024110000020

Denomination of invention: Asynchronous request processing methods, devices, devices, and storage media

Granted publication date: 20231003

License type: Common License

Record date: 20240315

EE01 Entry into force of recordation of patent licensing contract