WO2020082942A1 - Response timeout processing method, server, and client response timeout processing system - Google Patents

Response timeout processing method, server, and client response timeout processing system Download PDF

Info

Publication number
WO2020082942A1
WO2020082942A1 PCT/CN2019/106515 CN2019106515W WO2020082942A1 WO 2020082942 A1 WO2020082942 A1 WO 2020082942A1 CN 2019106515 W CN2019106515 W CN 2019106515W WO 2020082942 A1 WO2020082942 A1 WO 2020082942A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
request
client
completed
processing
Prior art date
Application number
PCT/CN2019/106515
Other languages
French (fr)
Chinese (zh)
Inventor
张明
叶国华
司孝波
周毅
Original Assignee
苏宁云计算有限公司
苏宁易购集团股份有限公司
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 苏宁云计算有限公司, 苏宁易购集团股份有限公司 filed Critical 苏宁云计算有限公司
Priority to CA3158476A priority Critical patent/CA3158476C/en
Publication of WO2020082942A1 publication Critical patent/WO2020082942A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Definitions

  • the invention relates to the technical field of computer applications, and in particular to a response timeout processing method, a server and a client response timeout processing system.
  • the client depends on the server to provide the required services.
  • the client sends request A to the server.
  • the server responds immediately after receiving request A and processes it.
  • the result is returned to the client, but in the actual application scenario, when the system is affected by factors such as network delays or network interruptions, the server may delay receiving or not receiving request A, and the corresponding server will delay correspondingly or not respond.
  • the client will start the fuse mechanism itself, prompting the user to time out abnormally, and at the same time perform a rollback operation for request A in time, so that the user can Request A to initiate a retry and complete the operation.
  • the server when a time-out abnormal event occurs, the server generally adopts a manual elimination or automatic rollback mechanism to deal with the abnormality. Because manual elimination takes a long time and has poor accuracy, which affects the user's experience, it is not suitable for large-scale promotion
  • the automatic rollback mechanism although it has the characteristics of high efficiency and timeliness, the server cannot monitor and identify the processing result, that is, it cannot determine whether the processing result is being processed or completed. Because the processing result being processed cannot be rolled back, if the server Rolling it back will cause the system to report an error.
  • the object of the present invention is to provide a response timeout processing method, a server and a client response timeout processing system, which can promptly, efficiently and accurately start a rollback mechanism to handle exceptions and improve user experience.
  • one aspect of the present invention provides a response timeout processing method, including:
  • Step S1 the server receives the service request sent by the client, and at the same time sets a progress identification character in the process of processing the service request;
  • Step S2 the server feeds back the request receipt to the client, and when the request receipt is a response timeout, it determines whether the current service request is completed by querying the progress identifier character;
  • Step S3 if the current service request processing is completed, perform a rollback operation on the service request, and if the current service request processing is not completed, change the progress identification character;
  • Step S4 after the execution of the processing process of the business request is completed, check whether the progress identification character has changed, when the check result is yes, perform a rollback operation on the business request, and delete the progress identification character at the same time, when the check result Otherwise, directly delete the progress identification character;
  • Step S5 return to step S1, and send the service request to the server again through the client until the request receipt response in step S2 does not time out.
  • step S1 the method for setting the progress identification character in the process of processing the service request is:
  • the progress identification character is set by the setnx method in the redis cache.
  • step S2 the server feeds back the request receipt to the client, and when the request receipt is the response timeout, the method for determining whether the current service request is completed by querying the progress identification character includes:
  • the server Based on the identification number of the current business request, the server queries the progress identification characters in the current business request processing process;
  • the progress identification character is a status value.
  • the business request is a non-idempotent service request.
  • the identification number of the business request is a business serial number or a business order number.
  • the response timeout processing method provided by the present invention has the following beneficial effects:
  • the server after receiving the service request sent by the client, the server first sets a progress identification character in the process of processing the business request, so as to determine the current business request by identifying the progress identification character in subsequent procedures Whether the processing is completed, the specific process is as follows, when the client does not receive the request receipt returned by the server within the preset time, it is considered that the request receipt response times out, at this time, the client will report an error to the user and automatically send the calling instruction to the server, Enables the server to query the progress identification characters previously set in the business request according to the calling instruction, and determine whether the current business request is completed based on the progress identification characters.
  • the judgment result is that the current business request processing is completed, you can directly complete the completed business Request to perform a rollback operation. If the current business request processing is not completed, the business request will not be rolled back temporarily, and only the above progress identification character will be changed until the completion of the above business request processing process, by checking the progress identification character whether Changed, when the result is yes, it means that the business request has not been rolled back before, at this time, only the business request needs to be rolled back, and the progress identification character is deleted, when the result is no, then It means that the business request has previously performed a rollback operation. In this case, you only need to delete the progress identifier character without repeating the rollback operation on the business request. Finally, the user sends the business request to the server again through the client to perform the above operation Until the user's request receipt response has not timed out.
  • the present invention sets the progress identification character in the processing process of the business request, and judges the processing progress of the current business request based on the progress identification character, so as to realize that the server can automatically perform the rollback operation when the current business request processing is completed.
  • the current business request will not be rolled back, and only measures to change the progress identification character will be taken to make it selective according to the change of the progress identification character after the processing process is executed.
  • the rollback operation is performed on business requests that have not performed a rollback operation, thereby effectively avoiding the system error caused by the rollback operation performed before the end of the processing process, and ensuring the accurate timing of the rollback operation.
  • the stability of the system in addition, compared with the processing mechanism for manually solving the response timeout in the prior art, adopting the timeout processing method provided by the invention also has the characteristics of being fast and efficient.
  • Another aspect of the present invention provides a server response timeout processing system, which is applied to the response timeout processing method described in the above technical solution, and the system includes:
  • the server setting unit the server receives the business request sent by the client, and is used to set the progress identification character in the processing process of the business request;
  • a server judgment unit the server feeds back the request receipt to the client, and when it is judged that the request receipt is the response timeout, it judges whether the current service request is completed by querying the progress identification character;
  • the server execution unit is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
  • the server checking unit is used to check whether the progress identification character has changed after the execution of the processing process of the business request is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character, When the check result is otherwise, directly delete the progress identification character;
  • the server retry unit is used to re-send a service request to the server through the client.
  • the server judgment unit includes:
  • the server query module is used to query the progress identification characters in the current business request processing process through the server based on the identification number of the current business request;
  • the server judgment module is used to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
  • the beneficial effects of the server response timeout processing system provided by the present invention are the same as the beneficial effects of the response timeout processing method provided by the above technical solution, which will not be repeated here.
  • a third aspect of the present invention provides a client response timeout processing system, which is applied to the response timeout processing method described in the above technical solution, and the system includes:
  • the client setting unit when the client sends a business request to the server, is used to set a progress identification character in the process of processing the business request;
  • the client judgment unit the client receives the request receipt returned by the server, and when it is determined that the request receipt is a response timeout, it is used to determine whether the current service request is completed by querying the progress identification character;
  • the client execution unit is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
  • the client check unit is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character at the same time , When the check result is otherwise, directly delete the progress identification character;
  • the client retry unit is used to re-send the service request to the server through the client.
  • the client judgment unit includes:
  • the client query module is used to query the progress identification characters in the current business request processing process through the client based on the identification number of the current business request;
  • the client judgment module is used to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
  • the beneficial effects of the client response timeout processing system provided by the present invention are the same as the beneficial effects of the response timeout processing method provided by the above technical solution, and will not be repeated here.
  • FIG. 1 is a schematic flowchart of a method for processing a response timeout in Embodiment 1 of the present invention
  • FIG. 3 is a structural block diagram of a server response timeout processing system in Embodiment 2 of the present invention.
  • FIG. 4 is a structural block diagram of a client response timeout processing system in Embodiment 3 of the present invention.
  • FIG. 1 is a method for processing a response timeout in Embodiment 1 of the present invention.
  • this embodiment provides a response timeout processing method, including:
  • Step S1 the server receives the business request sent by the client, and at the same time sets the progress identification character in the process of processing the business request; step S2, the server feeds back the request receipt to the client, and queries the progress identification character when the request receipt is the response timeout Determine whether the current business request is completed; Step S3, if the current business request processing is completed, perform a rollback operation on the business request, if the current business request processing is not completed, then change the progress identifier; Step S4, in the business request processing process After the execution is completed, check whether the progress indicator character has changed. When the check result is yes, perform a rollback operation on the business request and delete the progress indicator character. When the check result is otherwise, delete the progress indicator character directly; Step S5, return to step S1 The client sends the service request to the server again until the request receipt response in step S2 does not time out.
  • the server after receiving the service request sent by the client, the server first sets a progress identification character in the process of processing the business request, so as to determine the current service by identifying the progress identification character in subsequent procedures Whether the request is processed, the specific process is as follows.
  • the client does not receive the request receipt returned by the server within a preset time, it is considered that the request receipt response timed out.
  • the client will report an error to the user and automatically send a call instruction to the server , So that the server can query the progress identification character previously set in the business request according to the calling instruction, and judge whether the current business request is completed based on the progress identification character.
  • the server can automatically perform a rollback operation when the current business request processing is completed, and When the current business request has not been processed, in order to avoid the system reporting an error, the current business request will not be rolled back first, and only the measure of changing the progress identification character will be taken, so that it will be selected according to the change verification result of the progress identification character after the processing process is completed.
  • the response timeout processing method provided by this embodiment also has the characteristics of being fast and efficient.
  • the business request in the foregoing embodiment refers to a non-idempotent service request.
  • this embodiment uses the order lock coupon as an example to describe the following:
  • the business request processing includes calling the merchandise inventory resources and promotional preferential resources to lock the selected merchandise and the selected coupon, respectively, but when the client receives a response to the request receipt, the user is not clear whether the server has already selected the merchandise and If the selected coupon is locked, if you insist on performing a rollback operation if the above locking operation is not completed, it will lead to instability of the server, and in order to ensure the user's shopping experience, you cannot unilaterally ensure The above lock operation is completed and the server is left with too much execution time.
  • the progress identification character is set in the lock operation process, and the processing progress of the current lock operation is judged based on the progress identification character.
  • the server can automatically perform the rollback operation when the current lock operation processing is completed, and when the current lock operation is not completed, in order to avoid the system reporting an error, the rollback operation is not performed on the current lock operation, and only measures to change the progress identification character are taken After the execution of the lock operation is completed, it selectively rolls back the lock operation that has not performed the rollback operation according to the change verification result of the progress identification character, thereby effectively avoiding the lock operation from being executed before the end of the processing process.
  • the method for setting the progress identification character in the service request processing process is: in the service request processing process, the progress identification character is set by the setnx method in the redis cache.
  • the above progress identification character is a status value.
  • step S2 of the foregoing embodiment the server feeds back the request receipt to the client, and when the request receipt is the response timeout, the method for determining whether the current service request is completed by querying the progress identification character includes:
  • the server Based on the identification number of the current business request, the server queries the progress identification characters in the current business request processing process; if the current processing process is not ended and the query result exists, it outputs the current business request processing is not completed, otherwise it outputs the current business request processing is completed.
  • the identification number of the business request is a business serial number or a business order number.
  • this embodiment provides a server response timeout processing system, including:
  • the server setting unit 1 when the server receives the business request sent by the client, is used to set a progress identification character in the process of processing the business request;
  • Server judgment unit 2 the server feeds back the request receipt to the client, and judges whether the current service request is completed by querying the progress identification character when it judges that the request receipt is the response timeout;
  • the server execution unit 3 is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
  • the server checking unit 4 is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character at the same time , When the check result is otherwise, directly delete the progress identification character;
  • the server retry unit is used to re-send a service request to the server through the client.
  • the server judgment unit 2 includes:
  • the server query module 21 is used to query the progress identification character in the current business request processing process through the server based on the identification number of the current business request;
  • the server judgment module 22 is configured to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
  • the beneficial effects of the server response timeout processing system provided by the embodiment of the present invention are the same as the beneficial effects of the response timeout processing method provided by the foregoing embodiment 1, which will not be repeated here.
  • this embodiment provides a client response timeout processing system, including:
  • the client setting unit 6 is used to set a progress identification character in the process of processing a business request when the client sends a business request to the server;
  • the client judgment unit 7 the client receives the request receipt returned by the server, and when it is judged that the request receipt is a response timeout, it is used to determine whether the current service request is completed by querying the progress identification character;
  • the client execution unit 8 is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
  • the client checking unit 9 is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification Character, if the check result is otherwise, delete the progress identification character directly;
  • the client retry unit 10 is used to re-send the service request to the server through the client.
  • the client judgment unit 7 includes:
  • the client query module 71 is used to query the progress identification character in the current business request processing process through the client based on the identification number of the current business request;
  • the client judgment module 72 is configured to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
  • the beneficial effects of the client response timeout processing system provided by the embodiments of the present invention are the same as the beneficial effects of the response timeout processing method provided by the foregoing embodiment 1, which will not be repeated here.
  • the above program can be stored in a computer-readable storage medium.
  • the program When executed, it includes Each step of the method in the foregoing embodiment, and the storage medium may be: ROM / RAM, magnetic disk, optical disk, memory card, or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)
  • Retry When Errors Occur (AREA)
  • Telephonic Communication Services (AREA)

Abstract

Disclosed are a response timeout processing method, a server, and a client response timeout processing system; capable of promptly, efficiently, and accurately initiating a rollback mechanism to handle an error so as to improve the user experience. The method comprises: a server receiving a service request sent by a client, and simultaneously configuring a progress identification character while processing the service request; the server feeding back a request receipt to the client, and when the request receipt is a response timeout, querying the progress identification character to determine whether the current service request has been completed; if so, performing a rollback operation on the service request, and if not, changing the progress identification character; and after execution of the processing of the service request is completed, confirming whether the progress identification character has changed, if so, performing a rollback operation on the service request, and deleting the progress identification character, and if not, directly deleting the progress identification character.

Description

响应超时处理方法、服务器及客户端响应超时处理系统Response timeout processing method, server and client response timeout processing system 技术领域Technical field
本发明涉及计算机应用技术领域,尤其涉及一种响应超时处理方法、服务器及客户端响应超时处理系统。The invention relates to the technical field of computer applications, and in particular to a response timeout processing method, a server and a client response timeout processing system.
背景技术Background technique
在客户端-服务器系统中,客户端依赖服务器来提供所需的服务,系统正常交互时,如图2所示,客户端向服务器发送请求A,服务器在接收到请求A后立即响应并将处理结果回执给客户端,但在实际应用场景中,当系统受网络延迟或网络中断等因素影响时,服务器可能会延迟接收或者未接收到请求A,对应的服务器会延时相应或者未响应,此时,由于客户端在预设时间内未收到服务器的处理结果回执,客户端会自行启动熔断机制,提示用户超时异常,同时针对请求A及时进行回滚操作,以便用户能够在客户端中对请求A发起重试,完成操作。In a client-server system, the client depends on the server to provide the required services. When the system interacts normally, as shown in Figure 2, the client sends request A to the server. The server responds immediately after receiving request A and processes it. The result is returned to the client, but in the actual application scenario, when the system is affected by factors such as network delays or network interruptions, the server may delay receiving or not receiving request A, and the corresponding server will delay correspondingly or not respond. At the time, because the client did not receive the server's receipt of the processing result within the preset time, the client will start the fuse mechanism itself, prompting the user to time out abnormally, and at the same time perform a rollback operation for request A in time, so that the user can Request A to initiate a retry and complete the operation.
现有技术在发生超时异常事件时,服务器一般采取人工排除或者自动回滚机制来处理异常,由于人工排除耗时较长且准确性不佳,影响了用户的使用体验,因此不适宜大面积推广,对于自动回滚机制,虽然具有高效及时的特点,但是服务器无法对处理结果进行监测识别,即无法判断处理结果是正在处理还是完成处理,由于正在处理的处理结果无法进行回滚操作,假若服务器将其执意回滚,将会导致系统报错。In the prior art, when a time-out abnormal event occurs, the server generally adopts a manual elimination or automatic rollback mechanism to deal with the abnormality. Because manual elimination takes a long time and has poor accuracy, which affects the user's experience, it is not suitable for large-scale promotion For the automatic rollback mechanism, although it has the characteristics of high efficiency and timeliness, the server cannot monitor and identify the processing result, that is, it cannot determine whether the processing result is being processed or completed. Because the processing result being processed cannot be rolled back, if the server Rolling it back will cause the system to report an error.
发明内容Summary of the invention
本发明的目的在于提供一种响应超时处理方法、服务器及客户端响应超时处理系统,能够及时、高效、准确的启动回滚机制处理异常,提高用户体验。The object of the present invention is to provide a response timeout processing method, a server and a client response timeout processing system, which can promptly, efficiently and accurately start a rollback mechanism to handle exceptions and improve user experience.
为了实现上述目的,本发明的一方面提供一种响应超时处理方法,包括:In order to achieve the above object, one aspect of the present invention provides a response timeout processing method, including:
步骤S1,服务器接收客户端发送的业务请求,同时在业务请求的处理进程中设置进度标识字符;Step S1, the server receives the service request sent by the client, and at the same time sets a progress identification character in the process of processing the service request;
步骤S2,服务器向客户端反馈请求回执,并在请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成;Step S2, the server feeds back the request receipt to the client, and when the request receipt is a response timeout, it determines whether the current service request is completed by querying the progress identifier character;
步骤S3,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;Step S3, if the current service request processing is completed, perform a rollback operation on the service request, and if the current service request processing is not completed, change the progress identification character;
步骤S4,在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;Step S4, after the execution of the processing process of the business request is completed, check whether the progress identification character has changed, when the check result is yes, perform a rollback operation on the business request, and delete the progress identification character at the same time, when the check result Otherwise, directly delete the progress identification character;
步骤S5,返回步骤S1,通过客户端重新向服务器发送业务请求,直至步骤S2中的请求回执响应未超时为止。Step S5, return to step S1, and send the service request to the server again through the client until the request receipt response in step S2 does not time out.
优选地,在步骤S1中,在业务请求的处理进程中设置进度标识字符的方法为:Preferably, in step S1, the method for setting the progress identification character in the process of processing the service request is:
在业务请求处理进程中,通过redis缓存中的setnx方法设置进度标识字符。In the process of business request processing, the progress identification character is set by the setnx method in the redis cache.
优选地,在步骤S2中,服务器向客户端反馈请求回执,并在请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成的方法包括:Preferably, in step S2, the server feeds back the request receipt to the client, and when the request receipt is the response timeout, the method for determining whether the current service request is completed by querying the progress identification character includes:
服务器基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;Based on the identification number of the current business request, the server queries the progress identification characters in the current business request processing process;
若当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。If the current processing process is not ended and the query result exists, the output of the current business request processing is not completed, otherwise the output of the current business request processing is completed.
可选地,所述进度标识字符为状态值。Optionally, the progress identification character is a status value.
可选地,所述业务请求为非幂等服务请求。Optionally, the business request is a non-idempotent service request.
示例性地,所述业务请求的识别号为业务流水号或者业务订单号。Exemplarily, the identification number of the business request is a business serial number or a business order number.
与现有技术相比,本发明提供的响应超时处理方法具有以下有益效果:Compared with the prior art, the response timeout processing method provided by the present invention has the following beneficial effects:
本发明提供的响应超时处理方法中,服务器在接收到客户端发送的业务 请求后,首先在业务请求的处理进程中设置进度标识字符,以便在后续程序中通过识别进度标识字符来判断当前业务请求是否处理完成,具体过程如下,当客户端在预设时间内未收到服务器反馈的请求回执,则认为该请求回执响应超时,此时会通过客户端向用户报错并自动向服务器发送调用指令,使得服务器能够根据调用指令查询先前在业务请求中设置的进度标识字符,并基于该进度标识字符判断当前业务请求是否完成,若判断结果为当前业务请求处理已完成,则可直接对已完成的业务请求执行回滚操作,若当前业务请求处理未完成,则暂时不对该业务请求执行回滚操作,只对上述进度标识字符进行变更操作,直至上述业务请求处理进程执行完毕后,通过核对进度标识字符是否发生变更,当结果为是时,则说明该业务请求先前未执行过回滚操作,此时只需对该业务请求执行回滚操作即可,同时删除进度标识字符,当结果为否时,则说明该业务请求先前已执行过回滚操作,此时只需删除该进度标识字符即可而无需重复对该业务请求执行回滚操作,最后用户通过客户端重新向服务器发送业务请求,执行上述操作直至用户的请求回执响应未超时为止。In the response timeout processing method provided by the present invention, after receiving the service request sent by the client, the server first sets a progress identification character in the process of processing the business request, so as to determine the current business request by identifying the progress identification character in subsequent procedures Whether the processing is completed, the specific process is as follows, when the client does not receive the request receipt returned by the server within the preset time, it is considered that the request receipt response times out, at this time, the client will report an error to the user and automatically send the calling instruction to the server, Enables the server to query the progress identification characters previously set in the business request according to the calling instruction, and determine whether the current business request is completed based on the progress identification characters. If the judgment result is that the current business request processing is completed, you can directly complete the completed business Request to perform a rollback operation. If the current business request processing is not completed, the business request will not be rolled back temporarily, and only the above progress identification character will be changed until the completion of the above business request processing process, by checking the progress identification character whether Changed, when the result is yes, it means that the business request has not been rolled back before, at this time, only the business request needs to be rolled back, and the progress identification character is deleted, when the result is no, then It means that the business request has previously performed a rollback operation. In this case, you only need to delete the progress identifier character without repeating the rollback operation on the business request. Finally, the user sends the business request to the server again through the client to perform the above operation Until the user's request receipt response has not timed out.
可见,本发明通过在业务请求的处理进程中设置进度标识字符,并基于进度标识字符判断当前业务请求的处理进度,以实现在当前业务请求处理完成时服务器能够自动执行回滚操作,而在当前业务请求未处理完成时,为了避免系统报错先不对当前业务请求执行回滚操作,仅采取对进度标识字符进行变更的措施,使其在处理进程执行完毕后根据进度标识字符的变更核查结果选择性的对未执行过回滚操作的业务请求进行回滚操作,从而有效的避免了业务请求在处理进程结束前就执行回滚操作带来的系统报错的缺陷,保证了回滚操作启动时机的准确性以及系统的稳定性;另外,相比较于现有技术中通过人工解决响应超时的处理机制,采用本发明提供的超时处理方法还具有快速、高效地特点。It can be seen that the present invention sets the progress identification character in the processing process of the business request, and judges the processing progress of the current business request based on the progress identification character, so as to realize that the server can automatically perform the rollback operation when the current business request processing is completed. When the business request is not processed, in order to avoid the system reporting an error, the current business request will not be rolled back, and only measures to change the progress identification character will be taken to make it selective according to the change of the progress identification character after the processing process is executed. The rollback operation is performed on business requests that have not performed a rollback operation, thereby effectively avoiding the system error caused by the rollback operation performed before the end of the processing process, and ensuring the accurate timing of the rollback operation. And the stability of the system; in addition, compared with the processing mechanism for manually solving the response timeout in the prior art, adopting the timeout processing method provided by the invention also has the characteristics of being fast and efficient.
本发明的另一方面提供一种服务器响应超时处理系统,应用于上述技术方案所述的响应超时处理方法中,所述系统包括:Another aspect of the present invention provides a server response timeout processing system, which is applied to the response timeout processing method described in the above technical solution, and the system includes:
服务器设置单元,服务器接收客户端发送的业务请求,用于在业务请求的处理进程中设置进度标识字符;The server setting unit, the server receives the business request sent by the client, and is used to set the progress identification character in the processing process of the business request;
服务器判断单元,服务器向客户端反馈请求回执,并在判断请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成;A server judgment unit, the server feeds back the request receipt to the client, and when it is judged that the request receipt is the response timeout, it judges whether the current service request is completed by querying the progress identification character;
服务器执行单元,用于根据判断结果,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;The server execution unit is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
服务器检查单元,用于在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;The server checking unit is used to check whether the progress identification character has changed after the execution of the processing process of the business request is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character, When the check result is otherwise, directly delete the progress identification character;
服务器重试单元,用于通过客户端重新向服务器发送业务请求。The server retry unit is used to re-send a service request to the server through the client.
优选地,所述服务器判断单元包括:Preferably, the server judgment unit includes:
服务器查询模块,用于通过服务器基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;The server query module is used to query the progress identification characters in the current business request processing process through the server based on the identification number of the current business request;
服务器判断模块,用于在当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。The server judgment module is used to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
与现有技术相比,本发明提供的服务器响应超时处理系统的有益效果与上述技术方案提供的响应超时处理方法的有益效果相同,在此不做赘述。Compared with the prior art, the beneficial effects of the server response timeout processing system provided by the present invention are the same as the beneficial effects of the response timeout processing method provided by the above technical solution, which will not be repeated here.
本发明的第三方面提供一种客户端响应超时处理系统,应用于上述技术方案所述的响应超时处理方法中,所述系统包括:A third aspect of the present invention provides a client response timeout processing system, which is applied to the response timeout processing method described in the above technical solution, and the system includes:
客户端设置单元,在客户端向服务器发送业务请求时,用于在业务请求的处理进程中设置进度标识字符;The client setting unit, when the client sends a business request to the server, is used to set a progress identification character in the process of processing the business request;
客户端判断单元,客户端接收服务器反馈的请求回执,并在判断请求回执为响应超时时,用于通过查询所述进度标识字符判断当前业务请求是否完成;The client judgment unit, the client receives the request receipt returned by the server, and when it is determined that the request receipt is a response timeout, it is used to determine whether the current service request is completed by querying the progress identification character;
客户端执行单元,用于根据判断结果,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进 度标识字符;The client execution unit is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
客户端检查单元,用于在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;The client check unit is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character at the same time , When the check result is otherwise, directly delete the progress identification character;
客户端重试单元,用于通过客户端重新向服务器发送业务请求。The client retry unit is used to re-send the service request to the server through the client.
优选地,所述客户端判断单元包括:Preferably, the client judgment unit includes:
客户端查询模块,用于通过客户端基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;The client query module is used to query the progress identification characters in the current business request processing process through the client based on the identification number of the current business request;
客户端判断模块,用于在当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。The client judgment module is used to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
与现有技术相比,本发明提供的客户端响应超时处理系统的有益效果与上述技术方案提供的响应超时处理方法的有益效果相同,在此不做赘述。Compared with the prior art, the beneficial effects of the client response timeout processing system provided by the present invention are the same as the beneficial effects of the response timeout processing method provided by the above technical solution, and will not be repeated here.
附图说明BRIEF DESCRIPTION
此处所说明的附图用来提供对本发明的进一步理解,构成本发明的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an undue limitation on the present invention. In the drawings:
图1为本发明实施例一中响应超时处理方法的流程示意图;1 is a schematic flowchart of a method for processing a response timeout in Embodiment 1 of the present invention;
图2为本发明实施例一中响应超时的原理示例图;2 is an example diagram of the principle of response timeout in Embodiment 1 of the present invention;
图3为本发明实施例二中服务器响应超时处理系统的结构框图;3 is a structural block diagram of a server response timeout processing system in Embodiment 2 of the present invention;
图4为本发明实施例三中客户端响应超时处理系统的结构框图。4 is a structural block diagram of a client response timeout processing system in Embodiment 3 of the present invention.
附图标记:Reference mark:
1-服务器设置单元,                     2-服务器判断单元;1- Server setting unit, 2- Server judgment unit;
3-服务器执行单元,                     4-服务器检查单元;3- server execution unit, 4- server inspection unit;
5-服务器重试单元,                     21-服务器查询模块;5-Server retry unit, 21-server query module;
22-服务器判断模块,                    6-客户端设置单元;22-Server judgment module, 6-client setting unit;
7-客户端判断单元,                     8-客户端执行单元;7-Client judgment unit, 8-Client execution unit;
9-客户端检查单元,                     10-客户端重试单元;9-Client check unit, 10-Client retry unit;
71-客户端查询模块,                    72-客户端判断模块。71-Client query module, 72-Client judgment module.
具体实施方式detailed description
为使本发明的上述目的、特征和优点能够更加明显易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其它实施例,均属于本发明保护的范围。In order to make the above objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be described clearly and completely in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
实施例一Example one
图1为本发明实施例一中响应超时处理方法。请参阅图1,本实施例提供一种响应超时处理方法,包括:FIG. 1 is a method for processing a response timeout in Embodiment 1 of the present invention. Referring to FIG. 1, this embodiment provides a response timeout processing method, including:
步骤S1,服务器接收客户端发送的业务请求,同时在业务请求的处理进程中设置进度标识字符;步骤S2,服务器向客户端反馈请求回执,并在请求回执为响应超时时,通过查询进度标识字符判断当前业务请求是否完成;步骤S3,若当前业务请求处理已完成,则对业务请求执行回滚操作,若当前业务请求处理未完成,则变更进度标识字符;步骤S4,在业务请求的处理进程执行完毕后,检查进度标识字符是否发生变更,当检查结果为是则对业务请求执行回滚操作,同时删除进度标识字符,当检查结果为否则直接删除进度标识字符;步骤S5,返回步骤S1,通过客户端重新向服务器发送业务请求,直至步骤S2中的请求回执响应未超时为止。Step S1, the server receives the business request sent by the client, and at the same time sets the progress identification character in the process of processing the business request; step S2, the server feeds back the request receipt to the client, and queries the progress identification character when the request receipt is the response timeout Determine whether the current business request is completed; Step S3, if the current business request processing is completed, perform a rollback operation on the business request, if the current business request processing is not completed, then change the progress identifier; Step S4, in the business request processing process After the execution is completed, check whether the progress indicator character has changed. When the check result is yes, perform a rollback operation on the business request and delete the progress indicator character. When the check result is otherwise, delete the progress indicator character directly; Step S5, return to step S1 The client sends the service request to the server again until the request receipt response in step S2 does not time out.
本实施例提供的响应超时处理方法中,服务器在接收到客户端发送的业务请求后,首先在业务请求的处理进程中设置进度标识字符,以便在后续程序中通过识别进度标识字符来判断当前业务请求是否处理完成,具体过程如下,当客户端在预设时间内未收到服务器反馈的请求回执,则认为该请求回 执响应超时,此时会通过客户端向用户报错并自动向服务器发送调用指令,使得服务器能够根据调用指令查询先前在业务请求中设置的进度标识字符,并基于该进度标识字符判断当前业务请求是否完成,若判断结果为当前业务请求处理已完成,则可直接对已完成的业务请求执行回滚操作,若当前业务请求处理未完成,则暂时不对该业务请求执行回滚操作,只对上述进度标识字符进行变更操作,直至上述业务请求处理进程执行完毕后,通过核对进度标识字符是否发生变更,当结果为是时,则说明该业务请求先前未执行过回滚操作,此时只需对该业务请求执行回滚操作即可,同时删除进度标识字符,当结果为否时,则说明该业务请求先前已执行过回滚操作,此时只需删除该进度标识字符即可而无需重复对该业务请求执行回滚操作,最后用户通过客户端重新向服务器发送业务请求,执行上述操作直至用户的请求回执响应未超时为止。In the response timeout processing method provided by this embodiment, after receiving the service request sent by the client, the server first sets a progress identification character in the process of processing the business request, so as to determine the current service by identifying the progress identification character in subsequent procedures Whether the request is processed, the specific process is as follows. When the client does not receive the request receipt returned by the server within a preset time, it is considered that the request receipt response timed out. At this time, the client will report an error to the user and automatically send a call instruction to the server , So that the server can query the progress identification character previously set in the business request according to the calling instruction, and judge whether the current business request is completed based on the progress identification character. If the judgment result is that the current business request processing is completed, you can directly check the completed Perform a rollback operation on the business request. If the current business request processing is not completed, the business request will not be rolled back temporarily, and only the above progress identification character will be changed until the completion of the above business request processing process is completed. Character is No change, when the result is yes, it means that the business request has not previously performed a rollback operation. At this time, it is only necessary to perform a rollback operation on the business request, and delete the progress identification character. When the result is no, It means that the business request has previously performed a rollback operation. At this time, it is only necessary to delete the progress identification character without repeatedly performing the rollback operation on the business request. Finally, the user sends the business request to the server through the client again Operate until the user's request receipt response has not timed out.
可见,本实施例通过在业务请求的处理进程中设置进度标识字符,并基于进度标识字符判断当前业务请求的处理进度,以实现在当前业务请求处理完成时服务器能够自动执行回滚操作,而在当前业务请求未处理完成时,为了避免系统报错先不对当前业务请求执行回滚操作,仅采取对进度标识字符进行变更的措施,使其在处理进程执行完毕后根据进度标识字符的变更核查结果选择性的对未执行过回滚操作的业务请求进行回滚操作,从而有效的避免了业务请求在处理进程结束前就执行回滚操作带来的系统报错的缺陷,保证了回滚操作启动时机的准确性以及系统的稳定性;另外,相比较于现有技术中通过人工解决响应超时的处理机制,采用本实施例提供的响应超时处理方法还具有快速、高效地特点。It can be seen that in this embodiment, by setting a progress identification character in the processing process of the business request and judging the processing progress of the current business request based on the progress identification character, the server can automatically perform a rollback operation when the current business request processing is completed, and When the current business request has not been processed, in order to avoid the system reporting an error, the current business request will not be rolled back first, and only the measure of changing the progress identification character will be taken, so that it will be selected according to the change verification result of the progress identification character after the processing process is completed. Perform a rollback operation on business requests that have not performed a rollback operation, thus effectively avoiding the system error caused by the rollback operation performed before the end of the processing process, and ensuring the start time of the rollback operation Accuracy and stability of the system; in addition, compared with the processing mechanism for manually solving the response timeout in the prior art, the response timeout processing method provided by this embodiment also has the characteristics of being fast and efficient.
可以理解的是,上述实施例中的业务请求是指非幂等服务请求,为了使本领域技术人员能够对响应超时处理方法更好的理解,本实施例以订单锁券为例进行如下说明:It can be understood that the business request in the foregoing embodiment refers to a non-idempotent service request. In order to enable those skilled in the art to better understand the response timeout processing method, this embodiment uses the order lock coupon as an example to describe the following:
当用户在购物车中选好商品时,可同时选择合适的优惠券进行订单提交,此时服务器在收到订单提交的业务请求后,会立即对业务请求进行处理同时 向客户端反馈请求回执,其中,业务请求处理包括调用商品库存资源和促销优惠资源分别对所选商品和所选优惠券进行锁定,但是当客户端接收到请求回执的响应超时时用户并不清楚服务器是否已经对所选商品和所选优惠券锁定完毕,若在上述锁定操作未完毕的情况下执意对其执行回滚操作,将会导致服务器的不稳定性,而为了保证用户的购物体验,也不能够单方面的为了确保上述锁定操作执行完毕而留给服务器过多的执行时间,这种通过牺牲用户等待时间换来响应超时处理的方法将会降低用户的购物体验,显然也不合理。因此如何在锁定操作完成后尽快执行回滚操作成为了本实施例所要解决的关键问题,本实施例通过在锁定操作进程中设置进度标识字符,基于进度标识字符判断当前锁定操作的处理进度,以实现在当前锁定操作处理完成时服务器能够自动执行回滚操作,而在当前锁定操作未处理完成时,为了避免系统报错先不对当前锁定操作执行回滚操作,仅采取对进度标识字符进行变更的措施,使其在锁定操作执行完毕后根据进度标识字符的变更核查结果选择性的对未执行过回滚操作的锁定操作进行回滚操作,从而有效的避免了锁定操作在处理进程结束前就执行回滚操作带来的系统报错的缺陷。When the user selects a good product in the shopping cart, he can simultaneously select the appropriate coupon to submit the order. At this time, after receiving the business request submitted by the order, the server will immediately process the business request and feedback the request receipt to the client. , The business request processing includes calling the merchandise inventory resources and promotional preferential resources to lock the selected merchandise and the selected coupon, respectively, but when the client receives a response to the request receipt, the user is not clear whether the server has already selected the merchandise and If the selected coupon is locked, if you insist on performing a rollback operation if the above locking operation is not completed, it will lead to instability of the server, and in order to ensure the user's shopping experience, you cannot unilaterally ensure The above lock operation is completed and the server is left with too much execution time. This method of responding to timeout processing by sacrificing user waiting time will reduce the user's shopping experience, which is obviously unreasonable. Therefore, how to perform the rollback operation as soon as possible after the lock operation is completed has become the key problem to be solved in this embodiment. In this embodiment, the progress identification character is set in the lock operation process, and the processing progress of the current lock operation is judged based on the progress identification character. To realize that the server can automatically perform the rollback operation when the current lock operation processing is completed, and when the current lock operation is not completed, in order to avoid the system reporting an error, the rollback operation is not performed on the current lock operation, and only measures to change the progress identification character are taken After the execution of the lock operation is completed, it selectively rolls back the lock operation that has not performed the rollback operation according to the change verification result of the progress identification character, thereby effectively avoiding the lock operation from being executed before the end of the processing process. The system error caused by the roll operation.
示例性地,上述实施例步骤S1中,在业务请求的处理进程中设置进度标识字符的方法为:在业务请求处理进程中,通过redis缓存中的setnx方法设置进度标识字符。可选地,上述进度标识字符为状态值。Exemplarily, in step S1 of the foregoing embodiment, the method for setting the progress identification character in the service request processing process is: in the service request processing process, the progress identification character is set by the setnx method in the redis cache. Optionally, the above progress identification character is a status value.
进一步地,上述实施例步骤S2中,服务器向客户端反馈请求回执,并在请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成的方法包括:Further, in step S2 of the foregoing embodiment, the server feeds back the request receipt to the client, and when the request receipt is the response timeout, the method for determining whether the current service request is completed by querying the progress identification character includes:
服务器基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;若当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。示例性地,业务请求的识别号为业务流水号或者业务订单号。Based on the identification number of the current business request, the server queries the progress identification characters in the current business request processing process; if the current processing process is not ended and the query result exists, it outputs the current business request processing is not completed, otherwise it outputs the current business request processing is completed. Exemplarily, the identification number of the business request is a business serial number or a business order number.
实施例二Example 2
请参阅图1和图3,本实施例提供一种服务器响应超时处理系统,包括:Referring to FIGS. 1 and 3, this embodiment provides a server response timeout processing system, including:
服务器设置单元1,在服务器接收客户端发送的业务请求时,用于在业务请求的处理进程中设置进度标识字符;The server setting unit 1, when the server receives the business request sent by the client, is used to set a progress identification character in the process of processing the business request;
服务器判断单元2,服务器向客户端反馈请求回执,并在判断请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成; Server judgment unit 2, the server feeds back the request receipt to the client, and judges whether the current service request is completed by querying the progress identification character when it judges that the request receipt is the response timeout;
服务器执行单元3,用于根据判断结果,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;The server execution unit 3 is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
服务器检查单元4,用于在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;The server checking unit 4 is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character at the same time , When the check result is otherwise, directly delete the progress identification character;
服务器重试单元,用于通过客户端重新向服务器发送业务请求。The server retry unit is used to re-send a service request to the server through the client.
优选地,服务器判断单元2包括:Preferably, the server judgment unit 2 includes:
服务器查询模块21,用于通过服务器基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;The server query module 21 is used to query the progress identification character in the current business request processing process through the server based on the identification number of the current business request;
服务器判断模块22,用于在当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。The server judgment module 22 is configured to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
与现有技术相比,本发明实施例提供的服务器响应超时处理系统的有益效果与上述实施例一提供的响应超时处理方法的有益效果相同,在此不做赘述。Compared with the prior art, the beneficial effects of the server response timeout processing system provided by the embodiment of the present invention are the same as the beneficial effects of the response timeout processing method provided by the foregoing embodiment 1, which will not be repeated here.
实施例三Example Three
请参阅图1和图4,本实施例提供一种客户端响应超时处理系统,包括:Referring to FIGS. 1 and 4, this embodiment provides a client response timeout processing system, including:
客户端设置单元6,在客户端向服务器发送业务请求时,用于在业务请求的处理进程中设置进度标识字符;The client setting unit 6 is used to set a progress identification character in the process of processing a business request when the client sends a business request to the server;
客户端判断单元7,客户端接收服务器反馈的请求回执,并在判断请求回执为响应超时时,用于通过查询所述进度标识字符判断当前业务请求是否完 成;The client judgment unit 7, the client receives the request receipt returned by the server, and when it is judged that the request receipt is a response timeout, it is used to determine whether the current service request is completed by querying the progress identification character;
客户端执行单元8,用于根据判断结果,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;The client execution unit 8 is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
客户端检查单元9,用于在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;The client checking unit 9 is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification Character, if the check result is otherwise, delete the progress identification character directly;
客户端重试单元10,用于通过客户端重新向服务器发送业务请求。The client retry unit 10 is used to re-send the service request to the server through the client.
优选地,客户端判断单元7包括:Preferably, the client judgment unit 7 includes:
客户端查询模块71,用于通过客户端基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;The client query module 71 is used to query the progress identification character in the current business request processing process through the client based on the identification number of the current business request;
客户端判断模块72,用于在当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。The client judgment module 72 is configured to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
与现有技术相比,本发明实施例提供的客户端响应超时处理系统的有益效果与上述实施例一提供的响应超时处理方法的有益效果相同,在此不做赘述。Compared with the prior art, the beneficial effects of the client response timeout processing system provided by the embodiments of the present invention are the same as the beneficial effects of the response timeout processing method provided by the foregoing embodiment 1, which will not be repeated here.
本领域普通技术人员可以理解,实现上述发明方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,上述程序可以存储于计算机可读取存储介质中,该程序在执行时,包括上述实施例方法的各步骤,而所述的存储介质可以是:ROM/RAM、磁碟、光盘、存储卡等。A person of ordinary skill in the art can understand that all or part of the steps in the above-mentioned inventive method can be completed by instructing relevant hardware through a program. The above program can be stored in a computer-readable storage medium. When the program is executed, it includes Each step of the method in the foregoing embodiment, and the storage medium may be: ROM / RAM, magnetic disk, optical disk, memory card, or the like.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the scope of protection of the present invention is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present invention. It should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

  1. 一种响应超时处理方法,其特征在于,包括:A response timeout processing method, characterized in that it includes:
    步骤S1,服务器接收客户端发送的业务请求,同时在业务请求的处理进程中设置进度标识字符;Step S1, the server receives the service request sent by the client, and at the same time sets a progress identification character in the process of processing the service request;
    步骤S2,服务器向客户端反馈请求回执,并在请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成;Step S2, the server feeds back the request receipt to the client, and when the request receipt is a response timeout, it determines whether the current service request is completed by querying the progress identifier character;
    步骤S3,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;Step S3, if the current service request processing is completed, perform a rollback operation on the service request, and if the current service request processing is not completed, change the progress identification character;
    步骤S4,在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;Step S4, after the execution of the processing process of the business request is completed, check whether the progress identification character has changed, when the check result is yes, perform a rollback operation on the business request, and delete the progress identification character at the same time, when the check result Otherwise, directly delete the progress identification character;
    步骤S5,返回步骤S1,通过客户端重新向服务器发送业务请求,直至步骤S2中的请求回执响应未超时为止。Step S5, return to step S1, and send the service request to the server again through the client until the request receipt response in step S2 does not time out.
  2. 根据权利要求1所述的方法,其特征在于,在步骤S1中,在业务请求的处理进程中设置进度标识字符的方法为:The method according to claim 1, characterized in that, in step S1, the method of setting the progress identification character in the process of processing the service request is:
    在业务请求处理进程中,通过redis缓存中的setnx方法设置进度标识字符。In the process of business request processing, the progress identification character is set by the setnx method in the redis cache.
  3. 根据权利要求1所述的方法,其特征在于,在步骤S2中,服务器向客户端反馈请求回执,并在请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成的方法包括:The method according to claim 1, characterized in that, in step S2, the server feeds back a request receipt to the client, and when the request receipt is a response timeout, a method for determining whether the current service request is completed by querying the progress identification character include:
    服务器基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;Based on the identification number of the current business request, the server queries the progress identification characters in the current business request processing process;
    若当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。If the current processing process is not ended and the query result exists, the output of the current business request processing is not completed, otherwise the output of the current business request processing is completed.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述进度标识字 符为状态值。The method according to any one of claims 1-3, wherein the progress identification character is a status value.
  5. 根据权利要求1-3任一项所述的方法,其特征在于,所述业务请求为非幂等服务请求。The method according to any one of claims 1 to 3, wherein the service request is a non-idempotent service request.
  6. 根据权利要求3所述的方法,其特征在于,所述业务请求的识别号为业务流水号或者业务订单号。The method according to claim 3, wherein the identification number of the service request is a service serial number or a service order number.
  7. 一种服务器响应超时处理系统,其特征在于,包括:A server response timeout processing system, characterized in that it includes:
    服务器设置单元,服务器接收客户端发送的业务请求时,用于在业务请求的处理进程中设置进度标识字符;The server setting unit, when the server receives the business request sent by the client, it is used to set the progress identification character in the process of processing the business request;
    服务器判断单元,服务器向客户端反馈请求回执,并在判断请求回执为响应超时时,通过查询所述进度标识字符判断当前业务请求是否完成;A server judgment unit, the server feeds back the request receipt to the client, and when it is judged that the request receipt is the response timeout, it judges whether the current service request is completed by querying the progress identification character;
    服务器执行单元,用于根据判断结果,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;The server execution unit is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
    服务器检查单元,用于在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;The server checking unit is used to check whether the progress identification character has changed after the execution of the processing process of the business request is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character, When the check result is otherwise, directly delete the progress identification character;
    服务器重试单元,用于通过客户端重新向服务器发送业务请求。The server retry unit is used to re-send a service request to the server through the client.
  8. 根据权利要求1所述的系统,其特征在于,所述服务器判断单元包括:The system according to claim 1, wherein the server judgment unit includes:
    服务器查询模块,用于通过服务器基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;The server query module is used to query the progress identification characters in the current business request processing process through the server based on the identification number of the current business request;
    服务器判断模块,用于在当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。The server judgment module is used to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
  9. 一种客户端响应超时处理系统,其特征在于,包括:A client response timeout processing system, characterized in that it includes:
    客户端设置单元,在客户端向服务器发送业务请求时,用于在业务请求的处理进程中设置进度标识字符;The client setting unit, when the client sends a business request to the server, is used to set a progress identification character in the process of processing the business request;
    客户端判断单元,客户端接收服务器反馈的请求回执,并在判断请求回执为响应超时时,用于通过查询所述进度标识字符判断当前业务请求是否完成;The client judgment unit, the client receives the request receipt returned by the server, and when it is determined that the request receipt is a response timeout, it is used to determine whether the current service request is completed by querying the progress identification character;
    客户端执行单元,用于根据判断结果,若当前业务请求处理已完成,则对所述业务请求执行回滚操作,若当前业务请求处理未完成,则变更所述进度标识字符;The client execution unit is configured to perform a rollback operation on the business request if the current business request processing is completed according to the judgment result, and change the progress identification character if the current business request processing is not completed;
    客户端检查单元,用于在业务请求的处理进程执行完毕后,检查所述进度标识字符是否发生变更,当检查结果为是则对所述业务请求执行回滚操作,同时删除所述进度标识字符,当检查结果为否则直接删除所述进度标识字符;The client check unit is used to check whether the progress identification character has changed after the execution of the business request processing process is completed, and when the check result is yes, perform a rollback operation on the business request and delete the progress identification character at the same time , When the check result is otherwise, directly delete the progress identification character;
    客户端重试单元,用于通过客户端重新向服务器发送业务请求。The client retry unit is used to re-send the service request to the server through the client.
  10. 根据权利要求9所述的系统,其特征在于,所述客户端判断单元包括:The system according to claim 9, wherein the client judgment unit comprises:
    客户端查询模块,用于通过客户端基于当前业务请求的识别号,查询当前业务请求处理进程中的进度标识字符;The client query module is used to query the progress identification characters in the current business request processing process through the client based on the identification number of the current business request;
    客户端判断模块,用于在当前处理进程未结束且查询结果存在,则输出当前业务请求处理未完成,否则输出当前业务请求处理已完成。The client judgment module is used to output that the current business request processing is not completed if the current processing process is not completed and the query result exists, otherwise it is output that the current business request processing is completed.
PCT/CN2019/106515 2018-10-24 2019-09-18 Response timeout processing method, server, and client response timeout processing system WO2020082942A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA3158476A CA3158476C (en) 2018-10-24 2019-09-18 Method for processing response timeout, and systems for server and client to process response timeout

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811245297.2A CN109495452B (en) 2018-10-24 2018-10-24 Response timeout processing method, server and client response timeout processing system
CN201811245297.2 2018-10-24

Publications (1)

Publication Number Publication Date
WO2020082942A1 true WO2020082942A1 (en) 2020-04-30

Family

ID=65691544

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/106515 WO2020082942A1 (en) 2018-10-24 2019-09-18 Response timeout processing method, server, and client response timeout processing system

Country Status (3)

Country Link
CN (1) CN109495452B (en)
CA (1) CA3158476C (en)
WO (1) WO2020082942A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112351110A (en) * 2020-11-27 2021-02-09 杭州安恒信息技术股份有限公司 ID distribution method and device based on zookeeper

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109495452B (en) * 2018-10-24 2020-08-11 苏宁易购集团股份有限公司 Response timeout processing method, server and client response timeout processing system
CN111818489B (en) * 2019-04-11 2023-04-25 中国移动通信集团山东有限公司 Service opening time prediction method and service opening monitoring system
CN110275764B (en) * 2019-05-15 2024-03-19 创新先进技术有限公司 Method, device and system for processing call timeout
CN110417910B (en) * 2019-08-07 2022-04-22 北京达佳互联信息技术有限公司 Notification message sending method, device, server and storage medium
CN110391880A (en) * 2019-08-23 2019-10-29 聚好看科技股份有限公司 Access request processing method and equipment based on terminal-server framework
CN111899021A (en) * 2020-08-04 2020-11-06 武汉众邦银行股份有限公司 Method for realizing automatic receipt of super network bank account service
CN112565286A (en) * 2020-12-17 2021-03-26 金蝶软件(中国)有限公司 Task response method, device, equipment and storage medium based on RPC access
CN114430396B (en) * 2022-04-06 2022-07-05 中国光大银行股份有限公司 Transaction frequency control method and device, storage medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110679A (en) * 2007-08-21 2008-01-23 华为技术有限公司 Charging process protection method, system and business control point of on-line accounting system
US20110246822A1 (en) * 2010-04-01 2011-10-06 Mark Cameron Little Transaction participant registration with caveats
CN103019651A (en) * 2012-08-02 2013-04-03 青岛海信传媒网络技术有限公司 Parallel processing method and device for complex tasks
CN105989133A (en) * 2015-02-25 2016-10-05 阿里巴巴集团控股有限公司 Transaction processing method and device
CN108153598A (en) * 2017-12-25 2018-06-12 东软集团股份有限公司 Data consistency method and device based on micro services framework
CN109495452A (en) * 2018-10-24 2019-03-19 苏宁易购集团股份有限公司 Response timeout processing method, server and client end response timeout treatment system

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7559060B2 (en) * 2003-06-10 2009-07-07 National Instruments Corporation Time-bounded program execution
US20130179400A1 (en) * 2012-01-09 2013-07-11 Morgan Stanley Intelligent data publishing framework for common data updates in large scale networks of heterogeneous computer systems
CN103312549B (en) * 2013-06-26 2016-08-24 华为技术有限公司 A kind of office management method and device and system
CN106570027B (en) * 2015-10-10 2020-08-25 阿里巴巴集团控股有限公司 Transactional task processing method and device
CN106844014B (en) * 2015-12-07 2020-04-28 阿里巴巴集团控股有限公司 Method and device for realizing suspension prevention of distributed transactions
CN105868029A (en) * 2015-12-11 2016-08-17 鼎点视讯科技有限公司 Consistency fault-tolerance processing method and system
CN107257363B (en) * 2017-05-27 2020-02-04 北京思特奇信息技术股份有限公司 Method and system for responding request of request terminal
CN108073684A (en) * 2017-11-16 2018-05-25 深圳市买买提信息科技有限公司 A kind of data processing method, server and computer readable storage medium
CN108038141A (en) * 2017-11-27 2018-05-15 国云科技股份有限公司 Ensure the method for data consistency under micro services framework HTTP interactive modes
CN108205440A (en) * 2017-12-25 2018-06-26 国云科技股份有限公司 A kind of task flow framework implementation method for supporting rollback

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110679A (en) * 2007-08-21 2008-01-23 华为技术有限公司 Charging process protection method, system and business control point of on-line accounting system
US20110246822A1 (en) * 2010-04-01 2011-10-06 Mark Cameron Little Transaction participant registration with caveats
CN103019651A (en) * 2012-08-02 2013-04-03 青岛海信传媒网络技术有限公司 Parallel processing method and device for complex tasks
CN105989133A (en) * 2015-02-25 2016-10-05 阿里巴巴集团控股有限公司 Transaction processing method and device
CN108153598A (en) * 2017-12-25 2018-06-12 东软集团股份有限公司 Data consistency method and device based on micro services framework
CN109495452A (en) * 2018-10-24 2019-03-19 苏宁易购集团股份有限公司 Response timeout processing method, server and client end response timeout treatment system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112351110A (en) * 2020-11-27 2021-02-09 杭州安恒信息技术股份有限公司 ID distribution method and device based on zookeeper

Also Published As

Publication number Publication date
CA3158476C (en) 2023-08-29
CN109495452B (en) 2020-08-11
CA3158476A1 (en) 2020-04-30
CN109495452A (en) 2019-03-19

Similar Documents

Publication Publication Date Title
WO2020082942A1 (en) Response timeout processing method, server, and client response timeout processing system
US10417692B2 (en) Recovery of e-commerce orders
CN111459575B (en) Call request processing method and device and computer storage medium
WO2017063520A1 (en) Method and apparatus for operating database
CN111176858A (en) Data request processing method and device
CN106648936B (en) Cooperative processing method, system and server based on microservice
US20140289104A1 (en) Method and System for Account Parallel Processing
CN111768288B (en) Service processing method, device, electronic equipment and storage medium
CN112817995B (en) Data processing method and device, electronic equipment and storage medium
CN106570027B (en) Transactional task processing method and device
US20230229669A1 (en) Synchronized data management in a distributed computing environment using microservice architecture
CN111400330A (en) Task processing method, device, equipment and computer readable storage medium
CN112003947A (en) System and verification method for preventing repeated requests from client to server
CN108874947B (en) Data processing system and data processing method
JP5329589B2 (en) Transaction processing system and operation method of transaction processing system
CN114896337A (en) Data uplink method, system, equipment and computer readable storage medium
CN111367934A (en) Data consistency checking method, device, server and medium
CN111049916A (en) Control method, control device, proxy server and storage medium
CN114039878B (en) Network request processing method and device, electronic equipment and storage medium
CN115019922A (en) Feedback method, device and equipment for recording and auditing and storage medium
CN112860770B (en) Report generation method, report generation device, electronic equipment and storage medium
CN110929135B (en) Query processing method and device
CN112637206A (en) Method and system for actively acquiring service data
CN111506445A (en) Method and system for preventing repeated malicious ordering of commodities based on REDIS cache
CN110941639B (en) Data processing method, data query method, device and equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19877064

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19877064

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 3158476

Country of ref document: CA

122 Ep: pct application non-entry in european phase

Ref document number: 19877064

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 12/01/2022)