Method, device, medium and equipment for refreshing front-end pending tasks

By using WebSocket connections and memory buffers to monitor user changes, the application server proactively sends refresh commands, solving the difficulty of real-time information updates caused by the statelessness of traditional HTTP. This enables real-time updates of to-do tasks and saves server resources.

CN115834695BActive Publication Date: 2024-10-29INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211452489.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-21
Publication Date
2024-10-29
Estimated Expiration
2042-11-21

AI Technical Summary

Technical Problem

The stateless nature of traditional HTTP requires clients to make active requests, making it impossible to automatically refresh real-time information, which wastes bandwidth and resources, especially in instant messaging and real-time data applications.

Method used

By using WebSocket connections and memory buffers on the application server, user changes are monitored, and refresh commands are proactively sent to the client to achieve real-time updates of tasks in the foreground.

Benefits of technology

It reduces data transmission volume, saves server resources, enables real-time refreshing of pending tasks, and solves the problem of automatic refreshing in scenarios with frequent information changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834695B_ABST
    Figure CN115834695B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device, medium and equipment for refreshing foreground pending tasks. The method comprises: after receiving pending tasks sent by a client, processing the pending tasks; storing the processed tasks in a database, and storing the users corresponding to the processed tasks as users to be refreshed in a memory buffer device; when it is detected that the users stored in the memory buffer device have changed, obtaining the newly added users to be refreshed from the memory buffer device; through a websocket connection established with the client, sending a refresh instruction to the client of the obtained user to be refreshed, so that the client receiving the refresh instruction obtains the processed tasks from the database, and updates the pending task list in the client of the user to be refreshed according to the obtained processed tasks. The present invention can realize real-time update of foreground pending tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data refreshing, and in particular to a method, device, medium and equipment for refreshing foreground pending tasks. Background Art

[0002] At present, system applications need to collect data from third-party business systems for unified display. Some data may have time-limited issues, such as pending data. When processing pending tasks, a single point jump is made to the third-party business system. After the third-party business system approves the pending tasks, it calls the completed interface to refresh the data in the background database to completed. After the background data is refreshed, the foreground data also needs to be automatically refreshed.

[0003] Since traditional HTTP is stateless, each request must be initiated by the client, and the server returns the result after processing, but it is difficult for the server to actively send data to the client. This traditional web model in which the client is the active party and the server is the passive party causes less trouble for web applications with infrequent information changes, but it brings great inconvenience to web applications involving real-time information, such as applications with instant messaging, real-time data, subscription push and other functions. To implement these highly real-time functions, polling and Comet technologies are often used. However, polling will lead to too many unnecessary requests, wasting traffic and server resources. Summary of the invention

[0004] In view of at least one of the above technical problems, an embodiment of the present invention provides a method, device, medium, and equipment for refreshing foreground to-do tasks.

[0005] According to a first aspect, an embodiment of the present invention provides a method for refreshing foreground to-do tasks, the method being executed by an application server, the method comprising:

[0006] After receiving the pending tasks sent by the client, the pending tasks are processed; wherein the pending tasks become processed tasks after being processed;

[0007] The processed tasks are stored in a database, and the users corresponding to the processed tasks are stored in a memory buffer device as users to be refreshed;

[0008] When it is detected that the users stored in the memory buffer device have changed, acquiring a newly added user to be refreshed from the memory buffer device;

[0009] Through the websocket connection established between the client and the application server, a refresh instruction is sent to the client of the user to be refreshed, so that the client receiving the refresh instruction obtains the processed tasks from the database, and updates the to-do task list in the client of the user to be refreshed according to the obtained processed tasks; wherein a websocket connection is pre-established between the client and the application server.

[0010] According to a second aspect, an embodiment of the present invention provides a device for refreshing foreground pending tasks, the device being deployed on an application server, and the device comprising:

[0011] The task handling module is used to process the pending tasks after receiving the pending tasks sent by the client; wherein the pending tasks become processed tasks after being processed;

[0012] A data storage module, used for storing the processed tasks in a database, and storing the users corresponding to the processed tasks as users to be refreshed in a memory buffer device;

[0013] A user acquisition module, configured to acquire a newly added user to be refreshed from the memory buffer device when detecting a change in the user stored in the memory buffer device;

[0014] An instruction sending module is used to send a refresh instruction to the client of the user to be refreshed through a websocket connection established with the client, so that the client receiving the refresh instruction obtains the processed tasks from the database and updates the to-do task list in the client of the user to be refreshed according to the obtained processed tasks; wherein a websocket connection is pre-established between the client and the application server.

[0015] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.

[0016] According to a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0017] The foreground to-do task refreshing method, device, medium, and equipment provided by the embodiments of the present invention, individually or in combination, have the following beneficial effects:

[0018] (1) After the application server processes the pending tasks, it will store the users who have completed the tasks as the users to be refreshed in the memory buffer device, monitor the memory buffer device through the program trigger, and then find out whether the users in the memory buffer device have changed. The application server will generate a refresh instruction based on the newly added users to be refreshed in the memory buffer device, and then send the refresh instruction to the corresponding client. The client will update the pending task list according to the refresh instruction, so as to achieve the effect of real-time refresh in the foreground. Because the WebSocket connection does not need to carry repeated header data every time it is transmitted, the amount of data transmitted through the WebSocket connection is much smaller than the Comet technology in the prior art. Server resources are saved. Moreover, through the WebSocket connection, the application server can actively send data, such as refresh instructions. In scenarios where information changes frequently, the refresh instructions can be sent in a timely manner, so that the client can achieve real-time refresh of pending tasks.

[0019] (2) In one embodiment, a program trigger is used to monitor whether the users stored in the memory buffer device have changed through polling, so as to avoid omission of users to be refreshed.

[0020] (3) In one embodiment, when the data receiving interface of the database receives the processed task, the user corresponding to the processed task is stored in the memory buffer device as a user to be refreshed, so as to ensure that the user to be refreshed can be stored in the memory buffer device in a timely manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 The figure is a flow chart of a method for refreshing foreground to-do tasks in one embodiment of the present invention. DETAILED DESCRIPTION

[0022] In a first aspect, an embodiment of the present invention provides a method for refreshing foreground pending tasks, the method being executed by an application server. Figure 1 The method comprises the following steps S110 to S140:

[0023] S110, after receiving the pending tasks sent by the client, processing the pending tasks; wherein the pending tasks become processed tasks after being processed;

[0024] That is to say, the client will send to-do tasks to the application server through http requests. After receiving the to-do tasks, the application server will process the to-do tasks accordingly, such as approval processing. After the processing is completed, the to-do tasks become processed tasks.

[0025] In one embodiment, the processing of the pending tasks may specifically include: approving the pending tasks, and the pending tasks become processed tasks after the approval process.

[0026] Of course, other processing methods may also be included.

[0027] The application server may be a background server of a third-party business system, that is, the background server of the third-party business system may process the pending tasks according to a certain processing logic.

[0028] Among them, users can send to-do tasks to the application server on the web client of the browser. On the web client of the browser, each user has multiple to-do tasks, which form a to-do task list. The user can see what to-do tasks he has in the to-do task list, and send these to-do tasks in batches or individually to the application server for processing by the application server.

[0029] S120, storing the processed tasks in a database, and storing the users corresponding to the processed tasks as users to be refreshed in a memory buffer device;

[0030] That is, the application server processes each received to-do task, and then stores the processed tasks in the database, and then stores the users corresponding to the processed tasks as users to be refreshed in the memory buffer device.

[0031] It can be seen that the function of the memory buffer device is to store the users to be refreshed, and the users to be refreshed refer to the users corresponding to the processed tasks. The function of the database is to store the processed tasks.

[0032] In one embodiment, S120 may include:

[0033] Storing the processed tasks in a database via a data receiving interface;

[0034] When the data receiving interface of the database receives the processed task, the user corresponding to the processed task is stored in the memory buffer device as a user to be refreshed.

[0035] That is to say, the database is provided with a data receiving interface, and the application server stores the processed tasks in the database through the data receiving interface. When the data receiving interface receives the processed tasks, the users corresponding to the processed tasks are stored in the memory buffer device as users to be refreshed, so as to avoid omission of users to be refreshed.

[0036] S130, when it is detected that the users stored in the memory buffer device have changed, obtaining a newly added user to be refreshed from the memory buffer device;

[0037] That is, the users to be refreshed stored in the memory buffer device are monitored, and if it is detected that a new user to be refreshed is added to the memory buffer device, the new user to be refreshed is obtained.

[0038] In one embodiment, a program trigger may be provided in the application server, and the program trigger is used to monitor whether the users stored in the memory buffer device change by polling; correspondingly, the S130 may specifically include: when the program trigger monitors that the users stored in the memory buffer device change, obtaining newly added users to be refreshed from the memory buffer device.

[0039] That is to say, a program trigger is deployed in the application server, and the function of the program trigger is to monitor the user changes of the memory buffer device by polling, and when the user changes in the memory buffer device are monitored, the newly added users to be refreshed are determined.

[0040] S140. Send a refresh instruction to the client of the user to be refreshed through the websocket connection established with the client, so that the client receiving the refresh instruction obtains the processed tasks from the database, and updates the to-do task list in the client of the user to be refreshed according to the obtained processed tasks; wherein a websocket connection is pre-established between the client and the application server.

[0041] It is understandable that before executing S140, a websocket connection needs to be established between the client and the application server, and data is transmitted through the websocket connection.

[0042] WebSocket is a protocol for full-duplex communication over a single TCP connection. WebSocket makes data exchange between the client and the server much simpler, allowing the server to actively push data to the client. The browser and the application server only need to complete a handshake to directly create a persistent connection between the two and perform two-way data transmission.

[0043] That is, a websocket connection is established between the client and the application server, and then the application server sends a refresh instruction to the client of the newly added user to be refreshed obtained from the memory buffer device through the websocket connection. When the client of the user to be refreshed receives the refresh instruction, it will obtain the processed tasks from the database, so that the user to be refreshed can know which tasks in his to-do task list have been processed, and then update the to-do task list, remove the processed tasks from the to-do task list, and mark the processed tasks as processed, so as to achieve the refresh of the client's to-do tasks, that is, the refresh of the foreground to-do tasks.

[0044] In one embodiment, the client may be configured to: generate a refresh request upon receiving the refresh instruction, and send the refresh request to the application server.

[0045] Correspondingly, the method provided by the embodiment of the present invention may further include:

[0046] When a refresh request sent by the client is received, the corresponding processed task is obtained from the database according to the user ID carried in the refresh request, and the processed task is returned to the client, so that the client updates the to-do task list.

[0047] That is to say, when the client receives the refresh instruction sent by the application server, it will generate a refresh request and then send the refresh request to the application server. When the application server receives the refresh request sent by the client, which carries the user ID, the application server obtains the corresponding processed task from the database according to the user ID, and then the application server returns the obtained processed task to the client, so that the client will receive its own processed task and can update the to-do task list.

[0048] It can be seen that in the embodiment of the present invention, a method for implementing real-time refresh of pending tasks based on websocket technology is provided, which solves the problem that the foreground cannot be automatically refreshed. Since the pending tasks are time-sensitive, after being processed in the application server, the processed tasks are sent to the database to refresh the database, but the foreground has not been refreshed at this time. To this end, a websocket connection is established between the client and the application server at the foreground. For example, after sending the pending tasks to the application server, the client sends a request to establish a websocket connection to the application server through JavaScript, so that a websocket connection is established between the client and the application server. After that, data can be transmitted between the client and the application server through the websocket connection. When the application server processes the pending tasks, the user who has handled the task will be stored in the memory buffer device as the user to be refreshed, and the memory buffer device will be monitored through the program trigger to learn whether the user in the memory buffer device has changed. The application server will generate a refresh instruction according to the newly added user to be refreshed in the memory buffer device, and then send the refresh order to the corresponding client. The client will update the list of pending tasks according to the refresh instruction, so as to achieve the effect of real-time refresh of the foreground.

[0049] In the above process, the sequence trigger monitors the changes of the memory buffer device in real time, and the application server can send a refresh instruction to the client at any time through the websocket connection, so that the client can perform a refresh operation, thereby achieving the effect of automatic refresh of the foreground to-do tasks and solving the timeliness problem.

[0050] In a second aspect, an embodiment of the present invention provides a device for refreshing foreground pending tasks, the device being deployed on an application server, and the device comprising:

[0051] The task handling module is used to process the pending tasks after receiving the pending tasks sent by the client; wherein the pending tasks become processed tasks after being processed;

[0052] A data storage module, used for storing the processed tasks in a database, and storing the users corresponding to the processed tasks as users to be refreshed in a memory buffer device;

[0053] A user acquisition module, configured to acquire a newly added user to be refreshed from the memory buffer device when detecting a change in the user stored in the memory buffer device;

[0054] An instruction sending module is used to send a refresh instruction to the client of the user to be refreshed through a websocket connection established with the client, so that the client receiving the refresh instruction obtains the processed tasks from the database and updates the to-do task list in the client of the user to be refreshed according to the obtained processed tasks; wherein a websocket connection is pre-established between the client and the application server.

[0055] In one embodiment, a program trigger is provided in the application server, and the program trigger is used to monitor whether there is any change in the users stored in the memory buffer device by polling; correspondingly, the user acquisition module is specifically used to: when a change in the users stored in the memory buffer device is monitored by the program trigger, obtain the newly added users to be refreshed from the memory buffer device.

[0056] In one embodiment, the data storage module includes:

[0057] A first storage unit, used for storing the processed tasks in a database via a data receiving interface;

[0058] The second storage unit is used to store the user corresponding to the processed task as a user to be refreshed in the memory buffer device when the data receiving interface of the database receives the processed task.

[0059] In one embodiment, the task handling module is specifically used to: perform approval processing on the pending tasks, and the pending tasks become processed tasks after approval processing.

[0060] In one embodiment, the client is used to: generate a refresh request upon receiving the refresh instruction, and send the refresh request to the application server;

[0061] Correspondingly, the device further includes:

[0062] The task acquisition module is used to obtain the corresponding processed tasks from the database according to the user ID carried in the refresh request when receiving the refresh request sent by the client, and return the processed tasks to the client so that the client can update the to-do task list.

[0063] In one embodiment, the application server is a background server of a third-party business system.

[0064] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0065] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0066] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.

[0067] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0068] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0069] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0070] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0071] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0072] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.

[0073] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0074] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0075] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for refreshing foreground pending tasks, characterized in that: The method is executed by an application server, and comprises: After receiving the pending tasks sent by the client, the pending tasks are processed; wherein the pending tasks become processed tasks after being processed; The processed tasks are stored in a database, and the users corresponding to the processed tasks are stored in a memory buffer device as users to be refreshed; When it is detected that the users stored in the memory buffer device have changed, acquiring a newly added user to be refreshed from the memory buffer device; Through the websocket connection established between the client and the application server, a refresh instruction is sent to the client of the user to be refreshed, so that the client receiving the refresh instruction obtains the processed tasks from the database, and updates the to-do task list in the client of the user to be refreshed according to the obtained processed tasks; wherein a websocket connection is pre-established between the client and the application server.

2. The method according to claim 1, characterized in that: The application server is provided with a program trigger, and the program trigger is used to monitor whether the user stored in the memory buffer device changes by polling; Correspondingly, when monitoring changes in users stored in the memory buffer device, obtaining newly added users to be refreshed from the memory buffer device includes: when monitoring changes in users stored in the memory buffer device through the program trigger, obtaining newly added users to be refreshed from the memory buffer device.

3. The method according to claim 1, characterized in that The storing the processed tasks in a database and storing the users corresponding to the processed tasks as users to be refreshed in a memory buffer device includes: Storing the processed tasks in a database via a data receiving interface; When the data receiving interface of the database receives the processed task, the user corresponding to the processed task is stored in the memory buffer device as a user to be refreshed.

4. The method according to claim 1, characterized in that: The processing of the pending tasks includes: approving the pending tasks, and the pending tasks become processed tasks after the approval process.

5. The method according to claim 1, characterized in that The client is used to: generate a refresh request upon receiving the refresh instruction, and send the refresh request to the application server; Correspondingly, the method also includes: when receiving a refresh request sent by the client, obtaining the corresponding processed task from the database according to the user ID carried in the refresh request, and returning the processed task to the client so that the client can update the to-do task list.

6. The method according to claim 1, characterized in that The application server is a background server of a third-party business system.

7. A device for refreshing foreground pending tasks, characterized in that: The device is deployed on an application server and includes: The task handling module is used to process the pending tasks after receiving the pending tasks sent by the client; wherein the pending tasks become processed tasks after being processed; A data storage module, used for storing the processed tasks in a database, and storing the users corresponding to the processed tasks as users to be refreshed in a memory buffer device; A user acquisition module, configured to acquire a newly added user to be refreshed from the memory buffer device when detecting a change in the user stored in the memory buffer device; An instruction sending module is used to send a refresh instruction to the client of the user to be refreshed through a websocket connection established with the client, so that the client receiving the refresh instruction obtains the processed tasks from the database and updates the to-do task list in the client of the user to be refreshed according to the obtained processed tasks; wherein a websocket connection is pre-established between the client and the application server.

8. The device according to claim 7, characterized in that The application server is provided with a program trigger, and the program trigger is used to monitor whether the users stored in the memory buffer device change by polling; correspondingly, the user acquisition module is specifically used to: when the program trigger monitors that the users stored in the memory buffer device change, obtain the newly added users to be refreshed from the memory buffer device.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 6.

10. A computing device, characterized in that: The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Client data refreshing method and device and equipment

    CN113626740A

  • Task corner mark pushing method, device and equipment and readable medium

    CN113867958A