Method and device for resending interface request
By implementing the interface request resending method and device in the axios library, the problem of automatic resending of ajax requests when the network is poor or the server is unstable is solved, improving the user experience and request success rate, and reducing the pressure on the server.
Patent Information
- Application Number
- CN201911229042.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-12-04
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-12-04
AI Technical Summary
The existing axios library lacks the automatic resend function of ajax requests, which easily causes request errors when the network environment is poor or the server is unstable, affecting the user experience and possibly leading to user loss.
Provide a method and device for retransmitting an interface request. After sending a request to the server and receiving a failure message, the method obtains the number of retransmissions and the retransmission interval time threshold, determines the timing of retransmission of the request, and realizes the automatic retransmission of the ajax request.
The automatic resend function of ajax requests is realized without manual operation, which improves the request success rate, flexibly adjusts the resend interval and reduces the pressure on the server.
Smart Images

Figure CN112905930B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for resending an interface request. Background Art
[0002] The final product form of the Web front end mostly depends on the browser. As a common ajax (Asynchronous Javascript And XML) request communication used by browsers, axios is currently the most widely used ajax library. Web front-end developers use this ajax library to initiate ajax requests to communicate with the server to complete the addition, deletion and modification of data or interfaces.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] When the network environment is poor or the server is in an unstable scenario, it is easy to cause ajax request errors. The existing axios library lacks the function of automatically resending ajax requests, which affects the user experience and causes user loss. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides an interface request resending method and device, which can at least solve the problem that the existing function of automatically resending ajax requests cannot be realized.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for resending an interface request is provided, comprising:
[0007] Send a request to the server, receive a request failure message fed back by the server, and obtain a resend count threshold value corresponding to the interface sending the request;
[0008] Determine the number of times the request has been retransmitted, and if the number of times the request has been retransmitted is less than the retransmission number threshold, obtain a retransmission interval time threshold corresponding to the interface;
[0009] Based on the retransmission interval time threshold and the remaining number of retransmissions, the retransmission interval time for the request is determined so that a request retransmission operation is performed when the retransmission interval time is reached.
[0010] Optionally, after receiving the request failure message fed back by the server and before obtaining the retransmission number threshold corresponding to the interface, the method further includes:
[0011] A status code in the request failure message is obtained, and if the status code is a first status code, it is determined that the request is a resendable request.
[0012] Optionally, before obtaining the retransmission number threshold corresponding to the interface, the method further includes:
[0013] Determine the interface type of the interface according to the interface information of the interface, and obtain a retransmission number threshold and a retransmission interval time threshold corresponding to the interface type; and
[0014] In a database corresponding to the interface, the retransmission number threshold and the retransmission interval time threshold are registered to obtain configuration items of the interface.
[0015] Optionally, determining the retransmission interval for the request based on the retransmission interval threshold and the remaining number of retransmissions includes:
[0016] If the number of retransmissions is zero, it is determined that this is the first retransmission of the request, and the retransmission interval threshold is used as the retransmission interval of the request; or
[0017] If the number of retransmissions is greater than zero, it is determined that this is not the first retransmission of the request, and the ratio of the retransmission interval threshold to the remaining number of retransmissions is calculated, and the ratio is used as the retransmission interval for the request this time.
[0018] Optionally, after receiving the request failure message fed back by the server, the method further includes:
[0019] Obtaining a status code in the request failure message, and if the status code is a second status code, determining that the request is a non-retransmittable request; and
[0020] The number of request failures received within a predetermined time is counted, and if the number of request failures is greater than or equal to a predetermined request failure threshold, an abnormality reporting operation on the interface is triggered.
[0021] To achieve the above object, according to another aspect of an embodiment of the present invention, there is provided an interface request retransmission device, comprising:
[0022] An information receiving module, used to send a request to a server, receive a request failure message fed back by the server, and obtain a retransmission count threshold value corresponding to the interface sending the request;
[0023] A times comparison module, used for calculating the current number of retransmissions of the request, and if the number of retransmissions is less than the retransmission times threshold, obtaining a retransmission interval time threshold corresponding to the interface;
[0024] The request retransmission module is used to determine the retransmission interval time for the request based on the retransmission interval time threshold and the remaining retransmission times, so as to perform a request retransmission operation when the retransmission interval time is reached.
[0025] Optionally, the information receiving module is further used to:
[0026] A status code in the request failure message is obtained, and if the status code is a first status code, it is determined that the request is a resendable request.
[0027] Optionally, the information receiving module is used to:
[0028] Determine the interface type of the interface according to the interface information of the interface, and obtain a retransmission number threshold and a retransmission interval time threshold corresponding to the interface type; and
[0029] In a database corresponding to the interface, the retransmission number threshold and the retransmission interval time threshold are registered to obtain configuration items of the interface.
[0030] Optionally, the request resending module is used to:
[0031] If the number of retransmissions is zero, it is determined that this is the first retransmission of the request, and the retransmission interval threshold is used as the retransmission interval of the request; or
[0032] If the number of retransmissions is greater than zero, it is determined that this is not the first retransmission of the request, and the ratio of the retransmission interval threshold to the remaining number of retransmissions is calculated, and the ratio is used as the retransmission interval for the request this time.
[0033] Optionally, an exception reporting module is also included, which is used to:
[0034] Obtaining a status code in the request failure message, and if the status code is a second status code, determining that the request is a non-retransmittable request; and
[0035] The number of request failures received within a predetermined time is counted, and if the number of request failures is greater than or equal to a predetermined request failure threshold, an abnormality reporting operation on the interface is triggered.
[0036] To achieve the above objective, according to another aspect of an embodiment of the present invention, an interface request retransmission electronic device is provided.
[0037] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the interface request resending methods described above.
[0038] To achieve the above object, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned methods for resending an interface request is implemented.
[0039] According to the solution provided by the present invention, an embodiment of the above invention has the following advantages or beneficial effects: two parameters, the number of retransmissions and the retransmission interval, are set for the interface to realize automatic retransmission of ajax requests without manual operation; in addition, the retransmission interval for retransmissions greater than 1 can be adjusted according to the update strategy to realize the flexibility of request retransmission.
[0040] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0042] Figure 1 This is a schematic diagram of the main flow of an interface request resending method according to an embodiment of the present invention;
[0043] Figure 2 is a flowchart of a specific interface request resending method according to an embodiment of the present invention;
[0044] Figure 3 is a schematic diagram of main modules of an interface request retransmission device according to an embodiment of the present invention;
[0045] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0046] Figure 5 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0048] See also Figure 1 , which shows a main flow chart of an interface request retransmission method provided by an embodiment of the present invention, comprising the following steps:
[0049] S101: Send a request to a server, receive a request failure message fed back by the server, and obtain a retransmission count threshold corresponding to the interface for sending the request;
[0050] S102: Determine the number of retransmissions of the request at present, and if the number of retransmissions is less than the retransmission number threshold, obtain the retransmission interval time threshold corresponding to the interface;
[0051] S103: Based on the retransmission interval time threshold and the remaining number of retransmissions, determine the retransmission interval time for the request this time, so as to perform a request retransmission operation when the retransmission interval time is reached.
[0052] In the above implementation, for step S101, the present invention is mainly applicable to browser-side products, and the requests used are mainly ajax requests.
[0053] Ajax requests are mainly used on the browser side to implement asynchronous updates of web page data, that is, only a part of the web page is updated without reloading the entire web page; wherein, ajax requests indicate a web page development technology for creating interactive web page applications.
[0054] The success of an Ajax request depends on the stability of the network and the server. The http status code fed back by the server usually appears in different forms such as 2xx, 3xx, 4xx, etc. Web front-end developers will display different interface effects based on different http status codes.
[0055] For automatic resending of ajax requests, you can compare the status code of the ajax error request fed back by the server with the status code in the status pool to filter the interface requests that can be resent and those that cannot be resent:
[0056] 1) If the status code of the ajax error request is 3xx, 404, 451, 425, 500, or the status code agreed upon by the server developer (i.e., the second status code), no resend processing is performed, and the error request result is directly returned and the reporting backend service logic is triggered;
[0057] 2) For the remaining status codes (ie, the first status codes except the second status code), such as 2xx, etc., it means that the ajax request is a resendable request.
[0058] Among them, the http status code is a 3-digit code used to represent the hypertext transfer protocol response status of the web server. The first digit of all status codes represents one of the five states of the response.
[0059] The present invention sets two parameters, retry and retryDelay, for each interface; wherein retry represents the number of times axios is registered for retransmission, and retryDelay represents the interval time for registering axios for retransmission; for example, retry=5, retryDelay=2000.
[0060] It should be noted that different retry and retryDelay values may be set for different interfaces, for example, the retry value of interface 1 is 5 times, while the retry value of interface 2 is 7 times. The specific value is determined by the information of the interface, and the determination method is: according to the interface information of the interface, the interface type of the interface is determined, and then the retransmission number threshold and retransmission interval time threshold corresponding to the interface type are obtained.
[0061] Axios is an open source library for developers to use ajax technology. Web front-end developers use this ajax library to initiate ajax requests to communicate with the server to complete the addition, deletion and modification of data or interfaces. After configuring retry and retryDelay for the interface, the two parameters retry and retryDelay can be registered in the axios library for global configuration, which is convenient for subsequent comparison of resend times.
[0062] For step S102, the number of times the ajax request has been resent is counted to determine whether the number of times the request has been resent is greater than or equal to retry. If the result is yes, an error is directly returned and the reporting backend service logic is triggered; otherwise, a subsequent resent interval time determination operation is performed.
[0063] Furthermore, some interfaces may not have an ajax request resend setting, so you can first determine whether retry is greater than 0. For interface requests where retry is not 0, when a request failure message is received, you can directly return an error and trigger the reporting backend service logic.
[0064] For step S103, determine whether the number of retransmissions of the ajax request is less than 1:
[0065] 1) If it is less than 1, it means that the Ajax request is resent for the first time, and the resend interval threshold corresponding to the interface is used as the resend interval for this Ajax request, for example, a resend operation is performed at an interval of 2 seconds;
[0066] 2) If it is greater than or equal to 1, it means that this ajax request is not the first resend, and the retryDelay time needs to be updated. Specifically, it is calculated according to the following formula:
[0067] retryDelay=retryDelay / remaining number of retransmissions; wherein, remaining number of retransmissions=replay-number of retransmissions completed.
[0068] Assume that the interface sets the retry rule retry=5, retryDelay=2000. The first retransmission will be triggered after an interval of 2 seconds, the second retransmission will be triggered after 500 milliseconds, the third retransmission will be triggered after 667 milliseconds, the fourth retransmission will be triggered after 1 second, and the fifth retransmission will be triggered after 2 seconds. And when the retransmission interval is reached, an ajax request is made to retransmit.
[0069] The method provided in the above embodiment sets two parameters, the number of retransmissions and the retransmission interval, for the interface to realize automatic retransmission of ajax requests without manual operation; in addition, the retransmission interval for retransmissions greater than 1 can be adjusted according to the update strategy to achieve flexibility in request retransmission and avoid the situation where the server receives too many requests at the same time.
[0070] See also Figure 2 , shows a schematic flow chart of a specific interface request retransmission method according to an embodiment of the present invention, comprising the following steps:
[0071] S201: Send an ajax request from the interface to the server;
[0072] S202: receiving an ajax error request fed back by the server;
[0073] S203: Get the status code in the ajax error request;
[0074] S204: If the status code is the first status code, determining that the ajax request is a resendable request;
[0075] S205: If the status code is the second status code, the ajax request is determined to be a non-retransmittable request, no retransmission processing is performed, and the request is reported to the backend service;
[0076] S206: Obtain the retransmission threshold of the interface, and determine whether the number of retransmissions of the ajax request is less than the retransmission threshold;
[0077] S207: If it is less than, obtaining the retransmission interval time threshold corresponding to the interface;
[0078] S208: If it is greater than or equal to, no resending is performed and the backend service is reported;
[0079] S209: If the number of retransmissions is zero, it is determined that this is the first retransmission of the ajax request, and the retransmission interval threshold is used as the retransmission interval of the ajax request; or
[0080] S210: If the number of retransmissions is greater than zero, it is determined that this is not the first retransmission of the ajax request, and the ratio of the retransmission interval threshold to the remaining number of retransmissions is calculated, and the ratio is used as the retransmission interval of the ajax request;
[0081] S211: When the resending interval is reached, an ajax request is performed to resend the operation.
[0082] Compared with the prior art, the method provided by the embodiment of the present invention has at least the following beneficial effects:
[0083] 1) Analyze which requests are suitable for resending based on the http status code filtering strategy, so as to implement ajax request filtering;
[0084] 2) According to the data content provided by the interface, register the two parameters of ajax retry times (retry) and retry interval time (retryDelay) in the code to realize automatic resending of ajax requests and improve the success rate of ajax requests;
[0085] 3) If the number of retransmissions is not 1, the retransmission interval of the Ajax request is adaptively increased by triggering the time change strategy, thereby reducing the service pressure on the server;
[0086] 4) For Ajax requests that fail to resend or cannot be resent, the number of resends and the time consumed by the interface can be collected and uniformly reported to the backend server for processing, providing a basis for subsequent operation and maintenance personnel to judge the availability of the interface at different time periods and optimize the interface / server.
[0087] See also Figure 3 , shows a schematic diagram of main modules of an interface request retransmission device 300 provided in an embodiment of the present invention, including:
[0088] The information receiving module 301 is used to send a request to a server, receive a request failure message fed back by the server, and obtain a retransmission number threshold value corresponding to the interface sending the request;
[0089] The number comparison module 302 is used to calculate the number of retransmissions of the request at present, and if the number of retransmissions is less than the retransmission number threshold, obtain the retransmission interval time threshold corresponding to the interface;
[0090] The request retransmission module 303 is used to determine the retransmission interval time for the request this time based on the retransmission interval time threshold and the remaining number of retransmissions, so as to perform a request retransmission operation when the retransmission interval time is reached.
[0091] In the implementation device of the present invention, the information receiving module 301 is also used for:
[0092] A status code in the request failure message is obtained, and if the status code is a first status code, it is determined that the request is a resendable request.
[0093] In the implementation device of the present invention, the information receiving module 301 is used to:
[0094] Determine the interface type of the interface according to the interface information of the interface, and obtain a retransmission number threshold and a retransmission interval time threshold corresponding to the interface type; and
[0095] In a database corresponding to the interface, the retransmission number threshold and the retransmission interval time threshold are registered to obtain configuration items of the interface.
[0096] In the implementation device of the present invention, the request resending module 303 is used to:
[0097] If the number of retransmissions is zero, it is determined that this is the first retransmission of the request, and the retransmission interval threshold is used as the retransmission interval of the request; or
[0098] If the number of retransmissions is greater than zero, it is determined that this is not the first retransmission of the request, and the ratio of the retransmission interval threshold to the remaining number of retransmissions is calculated, and the ratio is used as the retransmission interval for the request this time.
[0099] The implementation device of the present invention further includes an abnormality reporting module 304 (not shown in the figure), which is used to:
[0100] Obtaining a status code in the request failure message, and if the status code is a second status code, determining that the request is a non-retransmittable request; and
[0101] The number of request failures received within a predetermined time is counted, and if the number of request failures is greater than or equal to a predetermined request failure threshold, an abnormality reporting operation on the interface is triggered.
[0102] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.
[0103] Figure 4 An exemplary system architecture 400 is shown in which embodiments of the present invention may be applied.
[0104] like Figure 4As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405 (just an example). Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0105] The user can use the terminal devices 401, 402, 403 to interact with the server 405 through the network 404 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 401, 402, 403.
[0106] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0107] The server 405 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 401 , 402 , and 403 (only as an example).
[0108] It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the device is generally set in the server 405 .
[0109] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0110] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0111] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0112] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0113] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0114] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0115] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0116] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes an information receiving module, a number comparison module, and a request retransmission module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the information receiving module may also be described as a "receiving request failure message module".
[0117] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0118] Send a request to the server, receive a request failure message fed back by the server, and obtain a resend count threshold value corresponding to the interface sending the request;
[0119] the current number of retransmissions of the request, and if the number of retransmissions is less than the retransmission threshold, obtaining a retransmission interval threshold corresponding to the interface;
[0120] Based on the retransmission interval time threshold and the remaining number of retransmissions, the retransmission interval time for the request is determined so that a request retransmission operation is performed when the retransmission interval time is reached.
[0121] Compared with the prior art, the technical solution according to the embodiment of the present invention has at least the following beneficial effects:
[0122] 1) Analyze which requests are suitable for resending based on the http status code filtering strategy, so as to implement ajax request filtering;
[0123] 2) According to the data content provided by the interface, register the two parameters of ajax retry times (retry) and retry interval time (retryDelay) in the code to realize automatic resending of ajax requests and improve the success rate of ajax requests;
[0124] 3) If the number of retransmissions is not 1, the retransmission interval of the Ajax request is adaptively increased by triggering the time change strategy, thereby reducing the service pressure on the server;
[0125] 4) For Ajax requests that fail to resend or cannot be resent, they can be uniformly reported to the backend server for processing, providing a basis for subsequent operation and maintenance personnel to judge the availability of the interface at different time periods and optimize the interface / server.
[0126] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An interface request resending method, It is characterized in that include: Send a request to the server, receive a request failure message fed back by the server, and obtain a resend count threshold value corresponding to the interface sending the request; Determine the number of times the request has been retransmitted, and if the number of times the request has been retransmitted is less than the retransmission number threshold, obtain a retransmission interval time threshold corresponding to the interface; Based on the retransmission interval time threshold and the remaining number of retransmissions, the retransmission interval time for the request is determined, so that the request retransmission operation is performed when the retransmission interval time is reached; wherein, if the number of retransmissions is greater than zero, it is determined that this is not the first retransmission of the request, and the ratio of the retransmission interval time threshold to the remaining number of retransmissions is calculated, and the ratio is used as the retransmission interval time for the request.
2. The method according to claim 1, It is characterized in that After receiving the request failure message fed back by the server and before obtaining the retransmission number threshold corresponding to the interface, the method further includes: A status code in the request failure message is obtained, and if the status code is a first status code, it is determined that the request is a resendable request.
3. The method according to claim 1, It is characterized in that Before obtaining the retransmission number threshold corresponding to the interface, the method further includes: Determine the interface type of the interface according to the interface information of the interface, and obtain a retransmission number threshold and a retransmission interval time threshold corresponding to the interface type; and In a database corresponding to the interface, the retransmission number threshold and the retransmission interval time threshold are registered to obtain configuration items of the interface.
4. The method according to any one of claims 1 to 3, It is characterized in that The determining the retransmission interval for the request based on the retransmission interval threshold and the remaining number of retransmissions also includes: If the number of retransmissions is zero, it is determined that this is the first retransmission of the request, and the retransmission interval threshold is used as the retransmission interval of the request.
5. The method according to claim 1, It is characterized in that After receiving the request failure message fed back by the server, the method further includes: Obtaining a status code in the request failure message, and if the status code is a second status code, determining that the request is a non-retransmittable request; and The number of request failures received within a predetermined time is counted, and if the number of request failures is greater than or equal to a predetermined request failure threshold, an abnormality reporting operation on the interface is triggered.
6. An interface request retransmission device, It is characterized in that include: An information receiving module, used to send a request to a server, receive a request failure message fed back by the server, and obtain a retransmission count threshold value corresponding to the interface sending the request; A times comparison module, used for calculating the current number of retransmissions of the request, and if the number of retransmissions is less than the retransmission times threshold, obtaining a retransmission interval time threshold corresponding to the interface; A request retransmission module is used to determine the retransmission interval time for the request this time based on the retransmission interval time threshold and the remaining number of retransmissions, so as to perform a request retransmission operation when the retransmission interval time is reached; wherein, if the number of retransmissions is greater than zero, it is determined that this is not the first retransmission of the request, and the ratio of the retransmission interval time threshold to the remaining number of retransmissions is calculated, and the ratio is used as the retransmission interval time for the request this time.
7. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.
8. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
