[go: up one dir, main page]

CN114885025B - 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
CN114885025B
CN114885025B CN202210674082.2A CN202210674082A CN114885025B CN 114885025 B CN114885025 B CN 114885025B CN 202210674082 A CN202210674082 A CN 202210674082A CN 114885025 B CN114885025 B CN 114885025B
Authority
CN
China
Prior art keywords
asynchronous
requests
request
asynchronous request
identifier
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.)
Active
Application number
CN202210674082.2A
Other languages
Chinese (zh)
Other versions
CN114885025A (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

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

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

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 includes receiving a plurality of asynchronous requests, the plurality of asynchronous requests including an asynchronous identification; recording the plurality of asynchronous requests and collecting processing functions of each asynchronous request; detecting the asynchronous interaction completion condition of the plurality of asynchronous requests in real time; and executing corresponding processing callback on the plurality of asynchronous requests after the asynchronous interaction of the plurality of asynchronous requests is completed. According to the technical scheme, a rendering mechanism is not required 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 pages 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, an asynchronous request processing device, an electronic device, and a computer readable storage medium.
Background
In the architecture mode that the client and the server are separated, the task of rendering pages by the background is liberated, and more rendering functions are put on the client. In order to realize a certain function, the client needs to send out 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 situation of wasting performance occurs.
Thus, in the face of large-scale, high-performance asynchronous requests, users need a new way of handling. When a large number of asynchronous requests are processed, a rendering mechanism needs to be frequently called, and the frequent refreshing of pages can bring about jamming and performance loss.
It should be noted that the information disclosed in the above background section is only for enhancing 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 implement an efficient and low-consumption asynchronous request processing scheme at least to some extent.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to one 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 asynchronous interaction completion condition of the plurality of asynchronous requests in real time;
and executing corresponding processing callback on the plurality of asynchronous requests after the asynchronous interaction of the plurality of asynchronous requests is completed.
In one embodiment of the present disclosure, the intercepting the plurality of asynchronous requests with asynchronous identifications includes:
receiving an asynchronous request;
judging whether the asynchronous request is provided with an asynchronous identifier or not;
intercepting the asynchronous request with the asynchronous identifier.
In one 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 queues of the plurality of asynchronous requests;
judging whether the asynchronous request in the queue is responded or not in real time;
when all of the asynchronous requests in the queue are responded to, it is determined that asynchronous interactions of the plurality of asynchronous requests are completed.
In one embodiment of the disclosure, the step of executing the corresponding processing callback on the plurality of asynchronous requests after the asynchronous interaction of the plurality of asynchronous requests is completed includes:
and after the asynchronous interaction of the plurality of asynchronous requests is completed, executing callback functions corresponding to the plurality of asynchronous requests in batches to generate processing data.
In one embodiment of the present disclosure, the asynchronous identification is point-in-time information of an asynchronous request.
In one embodiment of the present disclosure, after the step of executing the corresponding processing callbacks on the plurality of asynchronous requests, the method further includes:
and 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 interception module is used for intercepting a plurality of asynchronous requests with asynchronous identifiers;
the caching module is used for caching the plurality of asynchronous requests with the asynchronous identifiers;
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 plurality of asynchronous requests after the asynchronous interaction actions of the plurality of asynchronous requests are completed.
In one embodiment of the disclosure, the asynchronous request processing device is characterized in that the detection module includes:
the acquisition module is used for acquiring the queues of the plurality of asynchronous requests;
the judging module is used for judging whether the asynchronous request in the queue is responded or not in real time;
and the judging module is used for judging that the asynchronous interaction action of the plurality of asynchronous requests is completed when all the asynchronous requests in the queue are responded.
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 for communicatively coupling with 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 above in the first aspect.
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 in the first aspect described above.
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 a method of asynchronous request processing as in the first aspect described above.
According to the asynchronous request processing method provided by the embodiment of the disclosure, the asynchronous request can be responded in a time-sharing batch manner by setting the asynchronous identifier for the asynchronous request, so that a plurality of unnecessary view refreshing can be avoided in a large number of data interactions. Compared with the technical scheme in the prior art, the technical scheme disclosed by the application can solve the problems of stuck and performance loss caused by frequent refreshing in pages without frequently calling a rendering mechanism when a large number of asynchronous requests are processed.
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 disclosure and together with the description, serve to explain the principles of the disclosure. It will be apparent to those of ordinary skill in the art that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived from them without undue effort.
Fig. 1 is a schematic view of an application scenario 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 of asynchronous identification of a performance request of an asynchronous request processing method provided by an exemplary embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a method of intercepting asynchronous requests provided by an exemplary embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an asynchronous request processing apparatus provided by an exemplary embodiment of the present disclosure;
FIG. 6 is a schematic diagram of a detection module in an asynchronous request processing device according to an exemplary embodiment of the present disclosure;
fig. 7 is a schematic diagram of an asynchronous request processing electronic device provided in an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many 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 the 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 a repetitive description thereof 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 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 provided by the disclosure, 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 requirement and the actual capacity of the equipment, and the performance data acquisition mode can be dynamically adjusted according to the load condition of the equipment.
The scheme provided by the embodiment of the disclosure relates to the technical field of asynchronous request processing and the like in the technical field of network communication, and is specifically described by the following embodiments:
fig. 1 is an application scenario schematic 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 a network 130, where 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. The client device 120 may be a device running a client program, such as a smart phone, personal computer, etc. The client program may be an Application (APP) that communicates with the server program.
FIG. 2 is a flowchart of an asynchronous request processing method provided by an exemplary embodiment of the present disclosure, comprising:
s201, intercepting a plurality of asynchronous requests with asynchronous identifiers;
the server device 120 may receive the asynchronous request sent by the client device 110 and intercept the asynchronous request with an asynchronous identification therein.
The asynchronous request is that the client side gives the request to a proxy object, such as an XMLHttpRequest (browser object request), and the proxy object initiates the request to the server side, receives and analyzes the data responded by the server side, and updates the data to a control appointed by the client side, thereby realizing the local or whole refreshing of the page data. The asynchronous request makes the client end not wait for the response request of the server end, and the whole page is not reloaded to display the data responded by the server end, so that the client end can also perform other operations in the process of sending the asynchronous request.
The asynchronous request is mainly characterized in that the page display can not change in the process of starting and proceeding of acquiring data; after the data is acquired, specific display logic is operated according to the data, so that the interface of the webpage is refreshed locally or wholly.
The asynchronous identifier is an identifier used to determine whether an asynchronous request or a synchronous request is requested. The asynchronous identification 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 may carry the same asynchronous identifier. For example, in a web browsing scenario, where the client device 110 is configured to view a web page, the server device 120 is configured to provide a web page refresh service, the client device 110 needs to obtain a refresh page P from the server device 120, where the refresh page P includes multiple data, and the client device 100 typically sends multiple asynchronous requests to obtain the multiple data respectively. The multiple asynchronous requests for obtaining multiple data of the same refresh page P respectively carry the page identifier of the refresh page P, alternatively, the page identifier may be a page ID (Identity) of the refresh page P, or may be a URL (Uniform Response Locator, uniform resource locator) address of the refresh page P, which is not limited in this embodiment. Based on this, in implementation, the client device 110 may identify an asynchronous identifier in each asynchronous request, and determine the asynchronous request with the same asynchronous identifier as an asynchronous request requiring a unified callback.
The key point of an asynchronous request is the XMLHttpRequest object. The method by which different client devices create an XMLHttpRequest object is different. The IE browser uses an ActiveXObject, while the other browsers use a JavaScript built-in object named XMLHttpRequest. If this object needs to be created for a different client device, we use a "try and catch" statement. The following examples:
when the XMLHttpRequest object is created, the setting is needed, and the specific steps are as follows:
(1) Setting request parameters (request mode, relative path of request page, whether or not with asynchronous identification)
(2) Setting callback functions, a function for processing server response, using onreadystatechange, like function pointers, e.g.
(3) Acquiring a readyState attribute of an asynchronous object: the attribute stores state information of the server response. Whenever readystatechange is changed, the onreadystatechange function is executed.
Possible values for the readyState attribute:
the 0 request is not initialized (before the open () is called)
The 1 request has been proposed (before send () was called)
2 requests have been sent (where the content header is typically derived from the response)
In the 3 request processing (part of the data is usually available in the response, but the server has not completed the response yet)
4 request completed (the server response can be accessed and used)
At call time we add an If statement to this onreadystatechange function to test If our response is complete (meaning data is available):
(4) Judging the state of the response message, and if the state is 200, indicating that the server normally operates and returning response data.
(5) The response data is read, and the data returned by the server can be retrieved through the responseText attribute.
Examples are as follows:
s202, caching the plurality of asynchronous requests with the asynchronous identifiers;
the server device 120 caches the intercepted asynchronous request with the asynchronous identifier.
The server device 120 may cache 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 information, wherein the asynchronous request information is provided with asynchronous identifiers, and the asynchronous request information is arranged in a certain sequence.
The server device 120 may sequentially extract the asynchronous request information from the memory queue pool, process the asynchronous request, and execute the extracted asynchronous request information. Wherein the client device 110 may send an asynchronous request to the server device 120, and further receive various contents sent by the server device 120 for the asynchronous request. The server device 120 may sequentially extract the asynchronous request information according to the order of arrangement of the asynchronous request information in the memory queue pool. The server device 120 may simultaneously extract at least one asynchronous request message for processing. As an example, assuming a preset number of N, the N parallel request processing threads may sequentially fetch asynchronous requests from the memory queue pool in parallel. And after a certain thread executes an asynchronous request, continuously extracting asynchronous request information from the memory queue pool in sequence to process the asynchronous request. By setting a preset number of parallel request processing threads, the implementation manner can enable the server device 120 to process a plurality of asynchronous request information in parallel, so that the speed of processing the asynchronous request information is increased.
S203, detecting the asynchronous interaction completion condition of the plurality of asynchronous requests in real time;
in an exemplary embodiment of the present disclosure, the server device 120 may read the number of the asynchronous request information in the memory queue pool in real time, and when the number 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 plurality of asynchronous requests of the current page has been completed.
In one exemplary embodiment of the present disclosure, a record value of an asynchronous request is set according to a response to the asynchronous request. Sequentially accessing the recorded values of each asynchronous request, and judging whether the recorded value of the current access asynchronous request is a target value or not; if the record value of the asynchronous request is the target value, determining that the asynchronous request is responded by the server equipment 120; if the recorded value of the asynchronous request is not the target value, determining that the asynchronous request is not responded to by the server device currently.
For example, the server device 120 may set a record value of 1 for an asynchronous request when processing and responding to the asynchronous request is completed. The record value of the 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 to 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, is 0, it indicates that the asynchronous request is not currently responded to by the server device 200. In this manner, client device 110 may determine whether an asynchronous request has been responded to by server device 120 based on whether the recorded value of each asynchronous request is 1. The client device 110 in turn 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.
And S204, after the asynchronous interaction of the plurality of asynchronous requests is completed, executing corresponding processing callbacks on the plurality of asynchronous requests.
After determining the execution content of the asynchronous request, the server device 120 executes the processing request of the asynchronous request. For example, when an asynchronous request needs to operate on data (including operations of adding data, deleting data, modifying data, querying data, etc.), a corresponding data operation request is generated and sent to the server device 120, so that the server device 120 does not respond to the data operation request, 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 cache. If the asynchronous request has been responded to, the asynchronous request is dequeued, and when the queue is empty, the asynchronous request is fully responded to, and the asynchronous interaction of the plurality of asynchronous requests is judged to be completed.
Wherein the device unique identifier may be unique identification information of the target node, and the internet protocol address (Internet Protocol, IP) is a network layer protocol in the TCP/IP architecture. Providing datagram transport services to hosts.
When the server device 120 detects that all the interactions with the asynchronous request with the asynchronous identifier are completed, the corresponding processing functions are executed uniformly to obtain corresponding data, and the data is returned to the client, at this time, the client device 110 finishes rendering and refreshing the page according to the obtained data.
FIG. 3 is a schematic diagram of asynchronous identification of a performance request of an asynchronous request processing method provided by an exemplary embodiment of the present disclosure.
The asynchronous identifier is an identifier for determining whether an asynchronous request or a synchronous request is made at the time of a request. The asynchronous identification 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 typically carries the same asynchronous identifier. The asynchronization of 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 order the corresponding asynchronous requests according to the time.
When the client device 110 sets an asynchronous request, a time point information code can be added to the asynchronous request, and the server device 120 can 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 time of the asynchronous request is ordered by the time point information. Wherein the time point information is used to indicate the priority of the asynchronous request information being processed by the server device 120. As an example, the priority weight may be time point information, the more forward the time point information, the higher the priority level is indicated. The higher priority asynchronous request messages may be ranked before (i.e., prioritized), and the lower priority asynchronous request messages may be ranked after. The priority weight may be set manually in advance, or may be set automatically by the client device 110 or the server device 120 according to the type of the asynchronous request.
By setting the priority weight, the method in an exemplary embodiment of the present disclosure can implement that the high-priority asynchronous request is adjusted to the front end of the queue, that is, the high-priority asynchronous request is preferentially submitted to the server device 120 for execution, so that some important asynchronous request information can be preferentially executed, and the pertinence of executing the request is improved.
In some alternative implementations of one exemplary embodiment of the present disclosure, the client device 110 or the server device 120 may set a priority weight for the asynchronous request information in the memory queue pool according to a preset ordering period. That is, each time a period of time passes, the execution body resets the priority weights for the asynchronous requests in the memory queue pool, and further sorts the asynchronous requests in the memory queue pool according to the reset priority weights, thereby realizing real-time adjustment of the priority of the asynchronous requests and improving the pertinence of the dynamic execution of the asynchronous requests by the server device 120.
FIG. 4 is a schematic diagram of a method for intercepting asynchronous requests according to an exemplary embodiment of the present disclosure, including:
s401, receiving an asynchronous request. The server device 120 may receive asynchronous requests sent by the client device 110.
S402, judging whether the asynchronous request is provided with an asynchronous identification. 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 intercepting the asynchronous request if the asynchronous request carries an asynchronous identifier.
S404, if the asynchronous request does not have an asynchronous identifier, the asynchronous request is not intercepted.
By the method, whether the asynchronous requests need to be intercepted or not can be rapidly and accurately judged, and a large number of asynchronous requests can be processed in a targeted manner without frequently calling a rendering mechanism.
Fig. 5 is an asynchronous request processing apparatus provided by an exemplary embodiment of the present disclosure, in which an asynchronous request processing apparatus 500 includes, but is not limited to, the following modules: interception module 510, cache module 520, detection module 530, callback module 540.
The intercepting module 510 is configured to intercept a plurality of asynchronous requests with asynchronous identifiers.
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.
A caching module 520, configured to cache the plurality of asynchronous requests with asynchronous identifiers;
the server device 120 caches the intercepted asynchronous request with the asynchronous identifier, and sets the record value of the asynchronous request according to the response condition to the asynchronous request.
A detection module 530, configured to detect in real time an asynchronous interaction completion condition of the plurality of asynchronous requests;
sequentially detecting the recorded values of all the asynchronous requests, and judging whether the recorded value of the current asynchronous request is a target value or not; if the recorded value of the asynchronous request is the target value, determining that the asynchronous request is responded by the server-side equipment; if the recorded value of the asynchronous request is not the target value, determining that the asynchronous request is not responded to by the server device currently. The record value of each asynchronous request is sequentially detected, and when the record value of each asynchronous request is 1, the asynchronous interaction is completed.
For each asynchronous request which is sent to the server-side equipment and needs to be unified callback, sequentially detecting whether each asynchronous request is responded by the server-side equipment; if the currently detected asynchronous request is determined to be responded by the server-side equipment, detecting whether the next asynchronous request is responded by the server-side equipment or not; and if the currently detected asynchronization is not responded by the server equipment currently, waiting for the server equipment to respond to the asynchronization request, and detecting whether the next asynchronization request is responded by the server equipment or not when the currently detected asynchronization request is determined to be responded by the server equipment.
The callback module 540 is configured to execute a corresponding processing callback for an asynchronous request, and may specifically be configured to refresh page data requested by each of the asynchronous requests.
When all the interaction actions of the asynchronous requests with the asynchronous identification are completed, the callback module uniformly executes corresponding processing functions to obtain corresponding data, the data are returned to the client, and at the moment, the client finishes rendering and refreshing the page according to the obtained data.
Preferably, the asynchronous request processing device 500 further includes a storage module 550 for storing various types of data, which may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). The memory module 550 may be used to store instructions, programs, code sets, or instruction sets. 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 the various method embodiments described below, etc. The storage data area may also store data (recorded 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, configured to control operations of the interception module 510, the cache module 520, the detection module 530, the callback module 540, and the storage module 550.
In the exemplary embodiments provided in this disclosure, the modules shown or discussed may be coupled or directly coupled or communicatively connected to each other via some interface, whether indirectly coupled or communicatively connected to the devices or modules, whether electrically, mechanically, or otherwise.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
It should be noted that, since an asynchronous request processing apparatus in this embodiment and an asynchronous request processing method in any of the above embodiments are based on the same inventive concept, the corresponding content in the method embodiment is also applicable to the system embodiment, and will not be described in detail herein.
FIG. 6 is a schematic diagram of a detection module 600 in an asynchronous request processing device according to an exemplary embodiment of the present disclosure, including, but not limited to, the following: an acquisition module 610, a judgment module 620, and a judgment module 630.
Wherein, the obtaining module 610 is configured to obtain queues of the plurality of asynchronous requests;
a judging module 620, configured to judge in real time whether the asynchronous request in the queue is responded;
a determining module 630 is 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 cache. If the asynchronous request has been responded to, the asynchronous request is dequeued, and when the queue is empty, the asynchronous request is fully responded to, and the asynchronous interaction of the plurality of asynchronous requests is judged to be completed.
Fig. 7 is a schematic diagram of an asynchronous request processing device 700 according to an exemplary embodiment of the present disclosure, which may be any type of terminal, such as a mobile phone, a game host, a tablet computer, an electronic book reader, a smart glasses, an MP4 (MovingPicture Experts Group Audio Layer IV) player, a smart home device, an AR (Augmented Reality ) device, a VR (Virtual Reality) device, or the like, or a personal computer (Personal Computer, PC), such as a laptop portable computer, a desktop computer, or the like, a tablet computer, a personal computer, or the like.
Wherein the one kind of asynchronous request processing apparatus 700 may be installed with an application program for providing one kind of asynchronous request processing method.
Preferably, the asynchronous request processing apparatus 700 includes: one or more processors 710, and a memory 720, one processor 710 being illustrated in fig. 7.
Processor 710 and memory 720 may be connected by a bus or other means, fig. 7 being an example of a connection via a bus.
The memory 720 is used as a non-transitory computer readable storage medium, and may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to a reconfigurable intelligent surface-assisted asynchronous request processing device 700 device in an embodiment of the present application, for example, the interception module 510, the cache module 520, the detection module 530, and the callback module 540 shown in fig. 5. The processor 710 executes various functional applications and data processing of a reconfigurable intelligent surface-assisted asynchronous request processing device 500 by running non-transitory software programs, instructions, and modules stored in the memory 720, i.e., an asynchronous request processing method implementing the method embodiments described above.
Memory 720 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of one of the asynchronous request processing devices 500, etc. In addition, 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 remotely located with respect to processor 710, which may be connected to the one 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 (Local Area Network, LAN), metropolitan area network (Metropolitan Area Network, MAN), wide area network (Wide Area Network, WAN), mobile, wired or wireless network, 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 (Extensible MarkupLanguage, XML), and the like. All or some of the links may also be encrypted using conventional encryption techniques such as secure sockets layer (Secure Socket Layer, SSL), transport layer security (Transport Layer Security, TLS), virtual private network (Virtual Private Network, VPN), internet protocol security (Internet ProtocolSecurity, IPsec), etc. 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, which when executed by the one or more processors 710, perform an asynchronous request processing method of any of the method embodiments described above. For example, method steps S201 through S204 in FIG. 2, described above, and method steps S401 through S403 in FIG. 4 are performed to implement the functions of blocks 510-560 in FIG. 5, and to implement the functions of blocks 610-630 in FIG. 6.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, 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 (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
Embodiments of the present application also provide a computer-readable storage medium storing computer-executable instructions for execution by one or more processors, e.g., by one of the processors 710 in fig. 7, which may cause the one or more processors 710 to perform an asynchronous request processing method in the method embodiments described above, e.g., to perform the method steps S201 through S204 in fig. 2, and the method steps S401 through S403 in fig. 4 described above, to implement the functions of the modules 510-560 in fig. 5, and to implement the functions of the modules 610-630 in fig. 6.
Embodiments of the present application also provide 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 computer, by one of the processors 710 in fig. 7, cause the one or more processors 710 to perform an asynchronous request processing method of the method embodiments described above, for example, performing the method steps S201 to S204 of fig. 2, and the method steps S401 to S403 of fig. 4 described above, to implement the functions of the modules 510 to 560 of fig. 5, and to implement the functions of the modules 610 to 630 of fig. 6.
A program product for implementing the above method according to an embodiment of the present application is described, which may employ a portable compact disc read-only memory (CD-ROM) and comprise program code and may be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto, and in this 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. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable 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), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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 of the present application 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, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, 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., connected via the Internet using an Internet service provider).
Alternatively, 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. The specific form of the client of the application program may also be different based on the difference of the terminal platforms, for example, the application program client may be a mobile phone client, a PC client, or a World Wide Web (Web) client.
Those skilled in the art will appreciate that the number of devices 700 described above may be greater or lesser. Such as the above-mentioned terminals may be only one, or the above-mentioned terminals may be several tens or hundreds, or more. The embodiment of the present disclosure does not limit the number of terminals and the type of devices.
It is noted that the above-described figures are only schematic illustrations of processes involved in a method according to an exemplary embodiment of the application, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
Those skilled in the art will appreciate that the various aspects of the application may be implemented as a system, method, or program product. Accordingly, aspects of the application may be embodied in the following forms, namely: an entirely hardware embodiment, an entirely software embodiment (including firmware, micro-code, etc.) or an embodiment combining hardware and software aspects may be 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 a 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 in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Furthermore, although the steps of the methods in the present disclosure are depicted in a particular order in the drawings, this does not require or imply that the steps must be performed in that particular order or that all illustrated steps be performed in order to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, 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 (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform 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 adaptations, uses, or adaptations of the disclosure following the general 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 (9)

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 asynchronous interaction completion condition of the plurality of asynchronous requests in real time;
executing corresponding processing callback to the plurality of asynchronous requests after the asynchronous interaction of the plurality of asynchronous requests is completed;
wherein the asynchronous identifier is an identifier for judging whether an asynchronous request or a synchronous request is requested;
the method further comprises the steps of:
identifying asynchronous identifiers in each asynchronous request, and determining the asynchronous requests with the same asynchronous identifier as asynchronous requests needing unified callback;
wherein the asynchronous identifier is time point information of an asynchronous request;
the method further comprises the steps of:
and reading an asynchronous identifier with time point information in the asynchronous request, judging the time of receiving the asynchronous request, and sequencing the sequence of the corresponding asynchronous requests according to the time.
2. The method of claim 1, wherein the step of intercepting a plurality of asynchronous requests with asynchronous identifications comprises:
receiving an asynchronous request;
judging whether the asynchronous request is provided with an asynchronous identifier or not;
intercepting the asynchronous request with the asynchronous identifier.
3. The method of claim 1, wherein the step of detecting in real time the completion of the asynchronous interaction of the plurality of asynchronous requests comprises:
acquiring queues of the plurality of asynchronous requests;
judging whether the asynchronous request in the queue is responded or not in real time;
when all of the asynchronous requests in the queue are responded to, it is determined that asynchronous interactions of the plurality of asynchronous requests are completed.
4. The method of claim 1, wherein the step of executing the corresponding processing callback for the plurality of asynchronous requests after the asynchronous interaction of the plurality of asynchronous requests is completed comprises:
and after the asynchronous interaction of the plurality of asynchronous requests is completed, executing callback functions corresponding to the plurality of asynchronous requests in batches to generate processing data.
5. The method of claim 1, further comprising, after the step of executing the corresponding processing callback for the plurality of asynchronous requests:
and refreshing the page data requested by the plurality of asynchronous requests.
6. An asynchronous request processing device, comprising the following modules:
the interception module is used for intercepting a plurality of asynchronous requests with asynchronous identifiers;
the caching module is used for caching the plurality of asynchronous requests with the asynchronous identifiers;
the detection module is used for detecting the asynchronous interaction completion condition of the plurality of asynchronous requests in real time;
the callback module is used for executing corresponding processing callbacks on the plurality of asynchronous requests after the asynchronous interaction actions of the plurality of asynchronous requests are completed;
wherein the asynchronous identifier is an identifier for judging whether an asynchronous request or a synchronous request is requested;
the interception module is further configured to:
identifying asynchronous identifiers in each asynchronous request, and determining the asynchronous requests with the same asynchronous identifier as asynchronous requests needing unified callback;
wherein the asynchronous identifier is time point information of an asynchronous request;
the detection module is further used for:
and reading an asynchronous identifier with time point information in the asynchronous request, judging the time of receiving the asynchronous request, and sequencing the sequence of the corresponding asynchronous requests according to the time.
7. The asynchronous request processing apparatus of claim 6 wherein the detection module comprises:
the acquisition module is used for acquiring the queues of the plurality of asynchronous requests;
the judging module is used for judging whether the asynchronous request in the queue is responded or not in real time;
and the judging module is used for judging that the asynchronous interaction action of the plurality of asynchronous requests is completed when all the asynchronous requests in the queue are responded.
8. An asynchronous request processing electronic device, comprising: at least one processor and a memory for communicatively coupling with 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 according to any one of claims 1 to 5.
9. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements an asynchronous request processing method according to any of claims 1-5.
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 CN114885025A (en) 2022-08-09
CN114885025B true 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 (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9231995B2 (en) * 2011-09-30 2016-01-05 Oracle International Corporation System and method for providing asynchrony in web services
US9753785B2 (en) * 2014-07-24 2017-09-05 Home Box Office, Inc. Asynchronous dispatcher for application framework

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
CN114885025A (en) 2022-08-09

Similar Documents

Publication Publication Date Title
EP2661686B1 (en) Techniques for detecting inactive browser windows
EP2661708B1 (en) Techniques for detecting new browser windows
US9088462B2 (en) Common web accessible data store for client side page processing
WO2015074459A1 (en) Method and apparatus for opening webpage, invoking client, and creating light app
US10939480B2 (en) Enabling communications between a controlling device and a network-controlled device via a network-connected device service over a mobile communications network
US10284670B1 (en) Network-controlled device management session
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
CN113434384B (en) Pressure testing method and device
CN110598135A (en) Network request processing method and device, computer readable medium and electronic equipment
US9160804B2 (en) Web storage optimization
CN113612756B (en) Shared login method and device, computer readable storage medium and electronic equipment
CN114885025B (en) Asynchronous request processing method, device, equipment and storage medium
US10742639B1 (en) System and method for improving login and registration efficiency to network-accessed data
CN112491974B (en) Remote browsing method, device, storage medium, terminal equipment and server
CN116561013B (en) Test methods, devices, electronic equipment and media based on the target service framework
CN116089002A (en) Data simulation method, device, system, equipment and storage medium
CN109756393B (en) Information processing method, system, medium, and computing device
CN113704080A (en) Automatic testing method and device
CN113722642A (en) Webpage conversion method and device, electronic equipment and storage medium
CN114125066A (en) A method and device for processing service requests
CN111723312A (en) Data calling method, device, medium and electronic equipment
CN107835226A (en) The HTTP interface processing method and processing device of application program
CN118740762A (en) Method, device, electronic device and storage medium for accessing pre-release environment
CN118606577A (en) A page rendering method, device, system and readable storage medium

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