Task processing method and device, electronic equipment and storage medium

By using status flags to mark task processing failures in the delayed queue, the maintenance and tracking problems of delayed queue task processing failures are solved, thereby improving the timeliness and efficiency of task processing.

CN115145724BActive Publication Date: 2026-01-02BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210742094.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2026-01-02
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

Existing delayed queue technology struggles to effectively maintain and track task processing status when tasks fail.

Method used

A delayed queue combined with status flags is used to mark the status flags when task processing fails, and task tracking and maintenance are achieved through status flags.

Benefits of technology

It facilitates the maintenance and tracking of the processing status of different tasks, improving the timeliness and efficiency of task processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115145724B_ABST
    Figure CN115145724B_ABST
Patent Text Reader

Abstract

The present disclosure provides a task processing method and device, electronic equipment and storage medium, relates to the technical field of computers, in particular to the technical field of task processing of delay queues. The specific implementation scheme is: obtaining an expired target task from a delay queue; in the case of failure in processing the target task, determining the failure type of the target task; and marking the target task based on the state identifier corresponding to the failure type. In the embodiment of the present disclosure, the delay queue is combined with the state identifier, and the corresponding state identifier is marked in the case of failure in processing the task in the delay queue. Therefore, the processing of the task can be understood based on the state identifier when the task fails. The task tracking is realized based on the state identifier, thereby facilitating the maintenance and tracking of the processing of different tasks.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of computer technology, and particularly to the field of task processing of delay queue. BACKGROUND

[0002] Delay queue technology is widely used in various business scenarios. Before storing a delay task into a delay queue, the delay queue technology specifies an expiration time for the delay task, and when the expiration time arrives, a subsequent operation is started to process the delay task. Current delay queue implementation methods include timer task polling, Redis (Remote Field Service) ordered set, Redis expiration callback, and time wheel. However, no matter what kind of delay queue technology is used, there is a problem of difficult maintenance of tasks. SUMMARY

[0003] The present disclosure provides a task processing method and device, an electronic device, and a storage medium.

[0004] According to an aspect of the present disclosure, a task processing method is provided, including:

[0005] obtaining a target task that has expired from a delay queue;

[0006] in a case where processing the target task fails, determining a failure type of the target task;

[0007] based on a state identifier corresponding to the failure type, marking the target task.

[0008] According to a second aspect of the present disclosure, a task processing device is provided, including:

[0009] an obtaining module configured to obtain a target task that has expired from a delay queue;

[0010] a determining module configured to, in a case where processing the target task fails, determine a failure type of the target task;

[0011] a marking module configured to, based on a state identifier corresponding to the failure type, mark the target task.

[0012] According to a third aspect of the present disclosure, an electronic device is provided, including:

[0013] at least one processor; and

[0014] a memory in communication with the at least one processor; wherein

[0015] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the first aspect.

[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method in the first aspect.

[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method in the first aspect.

[0018] In the embodiments of the present disclosure, the delay queue is combined with the state identifier, and the corresponding state identifier is marked in the case of task processing failure in the delay queue. Thus, the processing condition of the task can be understood based on the state identifier when the task fails. The task tracking is realized based on the state identifier, thereby facilitating the maintenance and tracking of the processing conditions of different tasks.

[0019] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:

[0021] Figure 1 is a flow diagram of a task processing method according to an embodiment of the present disclosure;

[0022] Figure 2 is a flow diagram of a task processing method according to another embodiment of the present disclosure;

[0023] Figure 3 is a flow diagram of a task processing method according to another embodiment of the present disclosure;

[0024] Figure 4 is a flow diagram of a task processing method according to another embodiment of the present disclosure;

[0025] Figure 5 is a flow diagram of a task processing method according to another embodiment of the present disclosure;

[0026] Figure 6 is a framework diagram of a task processing method according to an embodiment of the present disclosure;

[0027] Figure 7 is a structural diagram of a task processing device according to an embodiment of the present disclosure;

[0028] Figure 8 is a structural diagram of a task processing device according to another embodiment of the present disclosure;

[0029] Figure 9is a block diagram of an electronic device for implementing a task processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, in which various details of the present disclosure are set forth to facilitate an understanding. However, it will be appreciated that various embodiments of the present disclosure can be practiced without such specific details. In other instances, well-known methods, structures and techniques have not been described in detail in order to avoid obscuring the present disclosure.

[0031] The terms "first", "second", and the like in the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a particular sequential or chronological order. In addition, the terms "comprises", "comprising", and any variations thereof are intended to cover not exclusive inclusion, for example, a series of steps or units. The method, system, product or device is not necessarily limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0032] According to an embodiment of the first aspect of the present disclosure, a task processing method is provided, as shown in Figure 1 The flowchart of the method is shown in

[0033] S101, obtaining an expired target task from a delay queue.

[0034] In some embodiments, the delay queue uses a redis ordered set. The redis ordered set can be a set of string type elements, and does not allow duplicate delay tasks. The delay tasks in the redis ordered set are unique.

[0035] As shown in Figure 2 A schematic diagram of the delay queue is shown in Figure 2 In the delay queue shown in Figure 2 As shown in, each delay task in the delay queue is associated with a score, and all delay tasks are sorted according to the score. The score of the delay task is related to the expiration time of the task. The delay task with earlier expiration time is sorted earlier in the delay queue.

[0036] When a new delay task D (10:03 expiration) is added to the delay queue, the score of task D is determined, and then the ranking position of task D in the delay queue is determined according to the score of task D. Assuming that the expiration time of task D is the nearest, task D will be ranked at the front of the delay queue. When the target task is obtained from the delay queue, assuming that the current time is T1, and the expiration time of task D is T2, if T1 is greater than or equal to T2, it means that task D has expired, and task D is obtained from the delay queue as the target task in step S101, and then the processing flow of the target task is started.

[0037] The processing logic of a delay task can be designed according to actual needs. For example, the delay task in the embodiment of the present disclosure can be a member benefit expiration task, a timed publishing task, a timed testing task, a timed backup task, etc.

[0038] Taking the timed testing task as an example, assuming that the target task is to recommend resources by screening multimedia resources according to user search requests. Since the process of screening multimedia resources needs to first perform a recall operation to obtain a recall result, since the recall result may include multiple multimedia resources, each multimedia resource in the recall result needs to be scored, and then the recall result is sorted according to the score. When testing the target task, the content of the test can include total time consumption test and scoring accuracy test. If the total time consumption test fails or the scoring accuracy test fails, an error will be reported. The failure type of the total time consumption test failure can be defined as time consumption test failure, and the failure type of the scoring accuracy test failure can be defined as scoring test failure. By analogy, no matter what kind of task the target task is, the subsequent processing of the task can include multiple nodes (such as total time consumption test and scoring accuracy test). As shown in Figure 3 , each node processing failure in the subsequent processing of each target task corresponds to a failure type.

[0039] S102, in the case of failure of processing the target task, determining the failure type of the target task.

[0040] S103, marking the target task based on the state identifier corresponding to the failure type.

[0041] Continuing to take Figure 3 as an example, each failure type corresponds to a state identifier. When implemented, the state identifier of different failure types can be defined according to business needs, and is applicable to the embodiment of the present disclosure.

[0042] In summary, in the embodiments of the present disclosure, the delay queue is combined with the state identifier, and the corresponding state identifier is marked in the case of task processing failure in the delay queue. Thus, the processing of the task can be understood based on the state identifier when the task fails. The task tracking is realized based on the state identifier, thereby facilitating the maintenance and tracking of the processing of different tasks.

[0043] Of course, in some embodiments, the state identifier is marked not only when the processing fails, but also when any node succeeds in processing the target task. The state identifier corresponding to the node can be recorded when the processing succeeds, which is used to indicate that the operation of the corresponding node is successfully completed. The state identifier when the processing fails is used to indicate that the operation of the corresponding node is not completed.

[0044] Correspondingly, in order to facilitate the maintenance of the task, the failure reason can also be recorded at the same time when the state identifier is recorded. For example, the failure reason of the time-consuming test is that the configuration file fails to be loaded. Of course, it should be noted that in order to facilitate the maintenance of the task, the recording mode of the failure reason can be designed according to actual needs, and the embodiments of the present disclosure do not limit this.

[0045] In some embodiments, in order to facilitate the maintenance of the task, a reserve queue can be added. The tasks of the delay queue are obtained from the reserve queue. The tasks in the reserve queue can also have a state identifier, one of which is used to indicate that the processing is not completed. Thus, the operation of taking the task from the reserve queue to the delay queue can be implemented as follows: selecting the task with the state identifier of to-be-processed from the reserve queue as a to-be-added delay task; and storing the to-be-added delay task in the delay queue.

[0046] In the embodiments of the present disclosure, the unprocessed delay task can be accurately obtained based on the state identifier, and stored in the delay queue to facilitate the timely processing of the delay task.

[0047] In some embodiments, the reserve queue can be a database (Data Base, DB). The DB is an organic collection of a large amount of data that can be shared, which is organized in a certain structure and stored in a computer for a long time. The DB is essentially a warehouse for storing data, and the data exists in a certain association and is stored in a computer in a certain format.

[0048] When the DB is used to construct the reserve queue, data loss can occur when data is concurrently written to the reserve queue. In order to avoid write conflicts, a lock mechanism can be used to deal with high concurrency in the embodiments of the present disclosure.

[0049] The data lock of the lock mechanism is divided into an optimistic lock and a pessimistic lock. The optimistic lock is suitable for a write-little-read-much scenario, and when multiple pieces of data are written at the same time, no waiting is needed and immediate processing can be performed. The pessimistic lock is suitable for a write-much-read-little scenario, and when a large amount of data needs to be written into a reserve queue, only one piece of data can be written, and other data needs to be waited for, that is, the next piece of data can continue to be written after the previous piece of data is executed.

[0050] In some embodiments, the reserve queue can only store a small amount of tasks that are about to expire, so that when the delay task stored in the reserve queue is obtained from the delay queue, the reserve queue stores a small amount of data instead of full data. It is relatively easy to obtain an unprocessed delay task from a small amount of data, which is beneficial to early detection of tasks that are about to expire and storage in the delay queue for processing. Therefore, in the embodiments of the present disclosure, a database for storing full data is also provided, and the maintenance of the reserve queue based on the database can be implemented as follows: obtaining a delay task with an expiration time within a specified time range from the database; storing the delay task in the reserve queue and marking the state identifier of the delay task as unprocessed.

[0051] For ease of understanding, the following will be described in combination with Figure 4 The relationship between the database, the reserve queue and the delay queue is described. As shown in Figure 4 , the database stores full data, and the specified time range is the next N days that are about to expire. Therefore, first, the tasks that are about to expire in the next N days are obtained from the full database and stored in the reserve queue and marked as unprocessed, and then when the tasks are obtained from the reserve queue, the delay tasks that are about to expire in the next N days are preferentially obtained into the delay queue, and then the tasks are processed by the corresponding business processor after expiration.

[0052] In the embodiments of the present disclosure, the reserve queue only stores delay tasks with an expiration time within a specified time range, thereby limiting the number of tasks in the reserve queue. Compared with finding unprocessed tasks from full data, finding unprocessed tasks from the reserve queue can reduce the amount of data to be processed, thereby improving the efficiency of finding unprocessed tasks. In the small and medium-sized data volume scenario, storing data with an expiration time within a specified time range in the reserve queue first also helps to early detect tasks that are about to expire, and to avoid the situation that the expired tasks are not processed in time as much as possible, thereby improving the timeliness of processing the expired tasks.

[0053] In some embodiments, if the full amount of data is traversed each time to find tasks with expiration times within the specified time range, resource waste will occur and efficiency needs to be improved. Therefore, in the embodiments of the present disclosure, when tasks are first obtained from the database and stored in the reserve queue, all tasks in the database need to be traversed. Then, each time the reserve queue is updated, an incremental update method can be used. When the reserve queue is updated incrementally, obtaining the delay tasks with expiration times within the specified time range from the database can be implemented as follows: in the case that there is at least one new task in the database, obtaining the expiration time corresponding to each of the at least one new task; in the case that the expiration time of a first task in the at least one new task is within the specified time range, regarding the first task as a delay task. The first task can be any task in the new tasks.

[0054] In the embodiments of the present disclosure, the tasks with expiration times within the specified time range are found in the new tasks in the database as delay tasks to be stored in the reserve queue, thereby realizing the storage of incremental tasks in the reserve queue by using an incremental update method, and improving the maintenance efficiency of the reserve queue and the incremental tasks.

[0055] In some embodiments, the reserve queue can have multiple shards, and each shard is used to store delay tasks in the reserve queue. When the number of tasks stored in the shards is not balanced, delay tasks are likely to be concentrated in one or more shards, which are referred to as hot shards, and the data in these hot shards is referred to as single-shard hotspot data. In order to avoid hot shards, in the embodiments of the present disclosure, when a delay task obtained from the full amount of database is added to the reserve queue, storing the delay task in the reserve queue can be implemented as shown in the following Figure 5

[0056] S501, determining a hash value of a task identifier of a delay task;

[0057] S502, determining a target shard corresponding to the hash value in a plurality of shards of the reserve queue;

[0058] S503, storing the delay task in the target shard.

[0059] Based on the embodiments of the present disclosure, each delay task can be stored in different shards by using the hash value of the task identifier, thereby balancing the number of tasks in each shard and avoiding as much as possible the concentration of a large number of delay tasks in some shards.

[0060] In some embodiments, in order to facilitate the tracking of the processing status of failed tasks, in the embodiments of the present disclosure, in the case that a target task fails to be processed, a state identifier of the target task is obtained based on a state tracking request for the target task; and the state tracking request is responded based on the state identifier of the target task. ​

[0061] For example, when an error occurs in the task processing process, the operation and maintenance personnel can be reminded to check the task processing situation, the operation and maintenance personnel can initiate a state tracking situation for the task, and then the state tracking request can be used to find the state identifier of the task and returned to the operation and maintenance personnel for viewing. Thus, the tracking of the failed task is realized.

[0062] In the embodiments of the present disclosure, the state tracking of the target task can be performed based on the state tracking request of the target task, thereby facilitating the management and maintenance of the target task.

[0063] The task processing method provided by the embodiments of the present disclosure will be described below taking the member benefit expiration task as an example. As shown in Figure 6 The database, the reserve queue, the delay queue, the message queue and the task processor are set for the member benefit expiration task, wherein:

[0064] The database, when executed for the first time, imports historical data into the database, so that the database stores all the member benefit tasks. The member benefit task records when the member expires. For example, the database stores member 1, which expires on June 10, 2022; member 2, which expires on June 6, 2022;

[0065] The reserve queue periodically polls the database and finds the member benefit tasks that will expire in the next N days from the database based on step ①. It should be noted that when polling for the first time, all member benefit tasks in the database are traversed to find the member benefit tasks that will expire in the next N days, and thereafter, the member benefit tasks that will expire in the next N days are found from the newly added tasks in the database. The period of the periodic polling can be set according to actual needs; the task state identifier of the member benefit task newly added to the reserve queue is 0, indicating that the newly added task is an unprocessed task. When a new unprocessed task is added to the reserve queue, the delay queue can be notified to obtain the task from the reserve queue;

[0066] The delay queue is a redis ordered set. The delay queue obtains the unprocessed task with a state identifier of 0 from the reserve queue based on the notification of the reserve queue, and adds it to the delay queue as a to-be-added task. After the to-be-added task is added to the delay queue, the state identifier remains unchanged. After being added to the delay queue, the to-be-added task can continue to be retained in the reserve queue and the state identifier remains unchanged;

[0067] The message queue periodically polls the delay queue based on step ③, obtains the expired task, i.e., the target task, and adds it to the message queue. Then the message queue consumes the task in step ④ to distribute the target task in the queue to the business processor for processing;

[0068] The business processor receives the task distributed by the message queue and performs business processing in step ⑤, such as performing the operation of removing the member pendant for the member benefit expiration task.

[0069] During execution, the processing results of the business processor are monitored. If the member widget is successfully removed, the status flag of the target task in the reserve queue is updated to 1 to indicate successful removal. If the removal fails, the target task is retained in the delayed queue. When the target task is polled again, it is retried. If multiple retries fail, the target task is removed from the delayed queue, and the status flag of the target task in the reserve queue is updated to 2 based on the failure type of the member widget removal failure to indicate failure.

[0070] It should be noted that in this embodiment, the number of reserve queues, delay queues, and message queues can be one or more. In implementation, each service can have its own corresponding reserve queue, delay queue, and message queue, based on business dimensions. Alternatively, multiple services can share a single reserve queue, while each service has its own corresponding delay queue and message queue. In short, the number of reserve queues, delay queues, and message queues can be configured according to actual needs, and this disclosure does not limit this number.

[0071] Based on the same inventive concept, a second aspect of the present disclosure provides a task processing state, such as... Figure 7 The diagram shown is a structural schematic of the device, which includes:

[0072] The acquisition module 701 is used to retrieve expired target tasks from the delay queue;

[0073] The determination module 702 is used to determine the failure type of the target task in the event that the target task processing fails;

[0074] The tagging module 703 is used to tag the target task based on the status identifier corresponding to the failure type.

[0075] In some embodiments, Figure 7 On the basis of, such as Figure 8 As shown, the device also includes:

[0076] The first selection module 804 is used to select tasks with a status of pending processing from the reserve queue as delayed tasks to be added.

[0077] Storage module 805 is used to store delayed tasks to be added into the delay queue.

[0078] In some embodiments, such as Figure 8 As shown, this state also includes

[0079] The second selection module 806 is used to retrieve delayed tasks with expiration times within a specified time range from the database;

[0080] The storage module 805 is further configured to store the delay task into the reserve queue, and mark the state identifier of the delay task as unprocessed.

[0081] In some embodiments, as shown in FIG. 8, the storage module 805 includes: Figure 8

[0082] The hash value determination unit 8051 is configured to determine a hash value of the task identifier of the delay task.

[0083] The shard determination unit 8052 is configured to determine a target shard corresponding to the hash value from a plurality of shards of the reserve queue.

[0084] The storage unit 8053 is configured to store the delay task into the target shard.

[0085] In some embodiments, as shown in FIG. 8, the second selection module 806 includes: Figure 8 The selection unit 8061 is configured to, in a case where there is at least one new task in the database, acquire an expiration time corresponding to each of the at least one new task.

[0086] The determination unit 8062 is configured to, in a case where the expiration time of a first task in the at least one new task is within a specified time range, take the first task as the delay task.

[0087] In some embodiments, as shown in FIG. 8, the apparatus further includes:

[0088] Figure 8 The tracking module 807 is configured to, in a case where the target task fails to be processed, acquire a state identifier of the target task based on a state tracking request for the target task.

[0089] The response module 808 is configured to respond to the state tracking request based on the state identifier of the target task.

[0090] In the embodiments of the present disclosure, the delay queue is combined with the state identifier, and in a case where the task in the delay queue fails to be processed, the corresponding state identifier is marked. Thus, in a case where the task fails, the processing of the task can be understood based on the state identifier. The state identifier is used to track the task, thereby facilitating the maintenance and tracking of the processing of different tasks.

[0091] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.

[0092]

[0093] Figure 9 ​​​A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0094] like Figure 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. The RAM 903 may also store various programs and data required for the operation of the electronic device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0095] Multiple components in electronic device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of displays, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows electronic device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0096] The computing unit 901 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the task processing method described above. In some embodiments, the task processing method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 908. In some embodiments, portions or all of the computer program can be loaded and / or installed onto the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded onto the RAM 903 and executed by the computing unit 901, one or more steps of the task processing method can be performed. Alternatively, in other embodiments, the computing unit 901 can be configured to perform the task processing method by other means, such as by means of firmware.

[0097] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, specially designed application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0098] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / operations specified in the flowchart and / or block diagram block or blocks. The program code can be retrieved from the storage system and / or the storage device and / or a remote storage or server and loaded into the computer, the processor or controller, or both.

[0099] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0100] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0101] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0102] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0103] It should be understood that the various forms of flow shown above can be used to reorder, add, or delete steps. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure can be achieved, which is not limited herein.

[0104] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A task processing method, comprising: obtaining an expired target task from a delay queue; determining a failure type of the target task in a case of failure in processing the target task; marking the target task based on a state identifier corresponding to the failure type; further comprising: obtaining a delay task with an expiration time within a specified time range from a database; the database stores full data, and a new task is stored in the database; storing the delay task in a reserve queue and marking a state identifier of the delay task as unprocessed; when a new unprocessed task is added in the reserve queue, notifying the delay queue to obtain a task; selecting a task with a state identifier as to-be-processed from the reserve queue as a to-be-added delay task; storing the to-be-added delay task in the delay queue.

2. The method of claim 1, wherein the storing the delay task in the reserve queue comprises: determining a hash value of a task identifier of the delay task; determining a target shard of a plurality of shards of the reserve queue corresponding to the hash value; storing the delay task in the target shard.

3. The method of claim 1, wherein the obtaining a delay task with an expiration time within a specified time range from a database comprises: in a case where there is at least one new task in the database, obtaining an expiration time corresponding to each of the at least one new task; in a case where an expiration time of a first task in the at least one new task is within the specified time range, taking the first task as the delay task.

4. The method of any one of claims 1-3, further comprising: in a case where the target task fails to be processed, obtaining a state identifier of the target task based on a state tracking request for the target task; responding to the state tracking request based on the state identifier of the target task.

5. A task processing apparatus, comprising: an obtaining module configured to obtain an expired target task from a delay queue; a determining module configured to determine a failure type of the target task in a case of failure in processing the target task; a marking module configured to mark the target task based on a state identifier corresponding to the failure type; further comprising: a second selecting module configured to obtain a delay task with an expiration time within a specified time range from a database; the database stores full data, and a new task is stored in the database; a storage module further configured to store the delay task in a reserve queue and mark a state identifier of the delay task as unprocessed; when a new unprocessed task is added in the reserve queue, notifying the delay queue to obtain a task; a first selecting module configured to select a task with a state identifier as to-be-processed from the reserve queue as a to-be-added delay task; a storage module configured to store the to-be-added delay task in the delay queue.

6. The apparatus of claim 5, wherein the storage module comprises: a hash value determination unit configured to determine a hash value of a task identifier of the delay task; a shard determination unit configured to determine a target shard of a plurality of shards of the reserve queue corresponding to the hash value; a storage unit, configured to store the delay task into the target shard. 7.The apparatus of claim 5, wherein the second selecting module comprises: a selecting unit, configured to acquire an expiration time corresponding to each of at least one new task in the database, in a case that the at least one new task exists in the database; a determining unit, configured to determine a first task in the at least one new task as the delay task, in a case that the expiration time of the first task is within the specified time range. 8.The apparatus of any one of claims 5-7, further comprising: a tracking module, configured to acquire a state identifier of the target task based on a state tracking request for the target task, in a case that the target task processing fails; a responding module, configured to respond to the state tracking request based on the state identifier of the target task. 9.An electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.

10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-4. 11.A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Method and system for realizing 5G slice member signing and de-signing by delay queue

    CN113260020A