Method and device for realizing task delay processing, equipment and storage medium
Patent Information
- Application Number
- CN202411363608.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-14
AI Technical Summary
The prior art is inefficient and inaccurate in task delay processing, especially in the case of large or high concurrency of tasks, resulting in increased database load and inefficient in task delay processing execution.
By splitting the scheduled tasks into task queues and assigning the task queues to time slots in the time wheel, the status of the task queue is updated according to the delay time, and the tasks stored in the time slot are executed according to the preset time wheel execution rules. queue.
It simplifies the task scheduling process, reduces the complexity of task scheduling, improves the accuracy and efficiency of task scheduling, enhances the scalability of task scheduling, and improves overall resource utilization, thereby effectively improving task management efficiency and efficiency. Task execution efficiency.
Smart Images

Figure CN119311389A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of task scheduling, and in particular to a method, device, equipment and storage medium for implementing task delay processing. Background Art
[0002] Task delay processing is often a very important and common issue in marketing activities. Task delay problem is usually handled by sending query requests to the database regularly through methods such as database polling. The database returns the query results, and the server performs corresponding processing based on the query results. However, this method is highly complex, labor-intensive, and has low execution efficiency.
[0003] The prior art usually processes task delays in the form of a scheduled task scan. For the data obtained by such scan, it is necessary to traverse all task objects and check one by one whether the task is delayed. However, in the case of large task volume or high concurrency, the data obtained by this method of database polling is often inaccurate; scanning the task information stored in the database one by one at a time will cause the database load and increase the database delay time when the scanning frequency is too high, thereby reducing the execution efficiency of task delay processing. Therefore, how to improve the accuracy and execution efficiency of task delay processing has become an urgent problem to be solved. Summary of the invention
[0004] The present invention provides a method, device, equipment and storage medium for implementing task delay processing, the main purpose of which is to solve the problems of low efficiency and inaccurate task delay processing.
[0005] To achieve the above object, the present invention provides a method for implementing task delay processing, comprising:
[0006] Receive a scheduled task, split the scheduled task into task queues, and assign the task queues to time slots in a time wheel;
[0007] Update the state of the task queue according to the delay time of the task queue, and store the updated task queue in the time slot of the time wheel;
[0008] The task queue stored in the time slot is executed according to a preset time wheel execution rule.
[0009] In some embodiments, splitting the scheduled tasks into task queues includes:
[0010] Divide the scheduling task according to the preset task queue granularity to obtain multiple subtasks;
[0011] The subtasks are arranged into a task queue according to priority attributes of the multiple subtasks.
[0012] In some embodiments, allocating the task queue to a time slot in a time wheel includes:
[0013] Calculate the time slot index corresponding to the task queue according to the execution time of the task queue;
[0014] The task queues are sequentially placed into the time slots in the time wheel according to the time slot indexes.
[0015] In some embodiments, updating the state of the task queue according to the delay time of the task queue includes:
[0016] Get the delay time of the task queue;
[0017] Determine the state of the task queue according to the delay time to obtain a delay queue;
[0018] The priority of the delay queue is adjusted to obtain a target task queue.
[0019] In some embodiments, storing the updated task queue into a time slot in a time wheel includes:
[0020] Calculate the time slot index corresponding to the target task queue according to the delay time of the target task queue;
[0021] The target task queue is added to the time slot according to the time slot index.
[0022] In some embodiments, executing the task queue stored in the time slot according to a preset time wheel execution rule includes:
[0023] The task queue is marked according to the delay time of the task queue to obtain an expired task queue and a task cancellation queue;
[0024] The pointer of the time wheel in the time wheel execution rule points to the execution of the expired task queue and the task cancellation queue.
[0025] In some embodiments, the executing the expired task queue and the task cancellation queue based on the pointer of the time wheel in the time wheel execution rule points to the expired task queue and the task cancellation queue, including:
[0026] Rotate the time wheel at a preset speed to obtain the pointer direction of the time wheel;
[0027] When the pointer points to the expired task queue or the task cancellation queue, the expired task queue is executed and the index of the task cancellation queue is removed.
[0028] In order to solve the above problem, the present invention further provides a task delay processing device, the device comprising:
[0029] A task allocation module receives a scheduled task, splits the scheduled task into task queues, and allocates the task queues to time slots in a time wheel;
[0030] A task storage module updates the state of the task queue according to the delay time of the task queue, and stores the updated task queue in the time slot of the time wheel;
[0031] The task execution module executes the task queue stored in the time slot according to a preset time wheel execution rule.
[0032] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0033] at least one processor; and,
[0034] a memory communicatively connected to the at least one processor; wherein,
[0035] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned method for implementing task delay processing.
[0036] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above method for implementing task delay processing.
[0037] The present invention splits the scheduling tasks into task queues and allocates them to time slots in a time wheel to simplify the task scheduling process, thereby reducing the complexity of task scheduling and effectively avoiding time conflicts; the status of the task queue is updated according to the delay time of the task queue, and the updated task queue is stored in the time slot of the time wheel, thereby improving the accuracy and efficiency of task scheduling and enhancing the scalability of task scheduling; the task queue stored in the time slot is executed according to the preset time wheel execution rules, which can improve the overall resource utilization, thereby effectively improving the task management efficiency and task execution efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A flowchart of a method for implementing task delay processing provided by an embodiment of the present invention;
[0039] Figure 2 A schematic diagram of the structure of a task delay processing device provided by an embodiment of the present invention;
[0040] Figure 3A schematic diagram of the structure of an electronic device of a task delay processing device provided by an embodiment of the present invention.
[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, and to fully understand and implement how the present disclosure applies technical means to solve technical problems and achieve the corresponding technical effects, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only embodiments of a part of the present disclosure, not all of the embodiments. The embodiments of the present disclosure and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present disclosure.
[0043] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0044] An embodiment of the present application provides a method for implementing task delay processing, and the execution subject of the method for implementing task delay processing includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the system provided by the embodiment of the present application. In other words, the method for implementing task delay processing can be executed by software or hardware installed on a terminal device or a server device. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0045] Reference Figure 1 FIG. 1 is a flow chart of a method for implementing task delay processing provided by an embodiment of the present invention. In this embodiment, the method for implementing task delay processing includes:
[0046] S1. Receive a scheduling task, split the scheduling task into task queues, and assign the task queues to time slots in a time wheel.
[0047] In an embodiment of the present invention, the scheduling task refers to a set of tasks that are scheduled for execution according to predetermined rules, time and sequence; for example, in a credit card marketing campaign, there are scheduling tasks such as giving points for the first swipe and drawing prizes for spending a certain amount.
[0048] The task queue is composed of a plurality of subtasks, and the subtasks are sorted according to their priorities to generate a task queue. The task queue contains information such as the execution time and execution cycle of the scheduled tasks.
[0049] The time wheel is usually a circular array used to execute the task queue, consisting of multiple time slots (array elements), each time slot represents a fixed time unit (such as 1 minute, five minutes, etc.), and the number of time slots and the selection of time periods depend on the time requirements of the task queue.
[0050] In an embodiment of the present invention, a preset scheduling system receives various scheduling tasks, and the scheduling tasks include task information such as task time, task content, and task cycle. The present invention can receive the task information of the scheduling task through a preset scheduling system or by calling a specific API interface, and the API interface can be GetPackageJob, GetAsyncTask, etc.
[0051] In detail, the present invention may allow a third party to directly input or submit a scheduling task in a graphical user interface GUI, or may allow an external service or a third-party API to communicate with a preset scheduling system to send the scheduling task.
[0052] In detail, in order to improve the efficiency of task execution, a complex scheduling task can be split into multiple manageable task queues, which can ensure that the task queues are allocated to time slots, thereby improving the efficiency of task scheduling management.
[0053] In the embodiment of the present invention, splitting the scheduling task into task queues includes:
[0054] Divide the scheduling task according to the preset task queue granularity to obtain multiple subtasks;
[0055] The subtasks are arranged into a task queue according to priority attributes of the multiple subtasks.
[0056] In detail, the task queue granularity refers to the complexity and workload of each subtask.
[0057] The present invention divides the scheduling task into subtasks that can be completed within multiple time periods according to the time granularity of the task queue, that is, the time requirement, to ensure that the subtasks obtained after the division are independent of each other and completely exhaustive.
[0058] For example, a one-month scheduling task can be divided into four weekly tasks, and each weekly task can be further divided into daily tasks. The tasks that are refined according to time requirements are called multiple subtasks.
[0059] The present invention can arrange the subtasks into a task queue through sorting methods such as bubble sort and quick sort. Among the subtasks to be sorted, two adjacent subtasks are compared according to the priority attribute. If the priority of the front subtask is lower than that of the rear subtask, the two subtasks are exchanged, otherwise they are not exchanged until the sorting is finally completed to obtain the task queue.
[0060] The present invention arranges the subtasks into task queues according to the priority attributes of the multiple subtasks. The priority attributes of the multiple subtasks are to solve the task queues that are executed in parallel at the same time. For example, the scheduling system pre-configures ten parallel task queues at 12:00. When the execution time approaches or reaches 12:00, the scheduling system will execute the task queues with higher priorities according to the priorities of the subtasks to ensure that they can be called by the program code first during the resource allocation and scheduling process.
[0061] In an embodiment of the present invention, a complex scheduling task is effectively split into multiple subtasks, and the subtasks are arranged into a task queue according to the priority attributes of the subtasks. This aims to maximize the timely execution of high-priority tasks by optimizing the scheduling order, thereby improving the timeliness and execution efficiency of the overall task processing.
[0062] In the embodiment of the present invention, allocating the task queue to a time slot in a time wheel includes:
[0063] Calculate the time slot index corresponding to the task queue according to the execution time of the task queue;
[0064] The task queues are sequentially placed into the time slots in the time wheel according to the time slot indexes.
[0065] In detail, assuming that the time wheel has a time slot of 5 minutes and the current time is 9 a.m., taking the "Raffle for Full-Amount Consumption" activity as an example, the activity is scheduled to start at 9:30 a.m., then the activity task will be calculated and placed in the time slot with an index of 6 in the time wheel (because from 9 a.m. to 9:30 a.m. is 30 minutes, divided by 5 minutes per time slot to get 6).
[0066] In an embodiment of the present invention, allocating the task queue to the time slot in the time wheel simplifies the task scheduling process. Based on the time wheel principle, the scheduled tasks are divided and allocated to fixed time slots, which reduces the complexity of task scheduling, effectively avoids time conflicts, and thus improves the efficiency of task scheduling.
[0067] S2. Update the state of the task queue according to the delay time of the task queue, and store the updated task queue into the time slot in the time wheel.
[0068] In the embodiment of the present invention, the delay time is used to specify the waiting time of the task queue, and the task queue is not executed immediately when it is received, but waits for a specified period of time before processing. The state of the task queue refers to the task queue being in progress, executed, unprocessed, etc., wherein the ongoing task queue may also include a delay queue, which refers to the task queue executed at the delay time.
[0069] In the embodiment of the present invention, the updating of the state of the task queue according to the delay time of the task queue includes:
[0070] Get the delay time of the task queue;
[0071] Determine the state of the task queue according to the delay time to obtain a delay queue;
[0072] The priority of the delay queue is adjusted to obtain a target task queue.
[0073] In detail, the delay time can mostly be obtained by subtracting the current time from the "earliest start time" of the task queue, and may also come from uncertain factors such as external factors (resource unavailability, equipment damage) and so on.
[0074] The present invention can mark the delay queue by a preset delay time identifier, and perform bubble sorting on the marked delay queue according to the priority of the task queue, so as to obtain the target task queue, i.e., the updated task queue. The present invention updates the state of the task queue according to the delay time of the task queue, timely adjusts the priority of the task queue, and regularly analyzes the delay time of the task queue, so as to optimize the process, improve efficiency and reduce costs.
[0075] In the embodiment of the present invention, storing the updated task queue into a time slot in a time wheel includes:
[0076] Calculate the time slot index corresponding to the target task queue according to the delay time of the target task queue;
[0077] The target task queue is added to the time slot according to the time slot index.
[0078] In detail, the delay time of the target task queue is converted into the time unit of the time wheel, and the total number of slots of the time wheel is modulo to obtain the time slot index, and the calculated time slot index is added to the array of time slots, so that the task queue is stored in the corresponding time slot.
[0079] In detail, suppose there is a "First swipe to get points" activity, which was originally scheduled to start at 10 am, but was postponed to 10:15 am for some reason. If the time wheel pointer has not reached the 10 o'clock time slot at this time, the "First swipe to get points" activity task will be removed from the original time slot and recalculated and placed in the time slot with index 15 (when each time slot is 5 minutes).
[0080] In an embodiment of the present invention, the updated task queue is stored in the time slot of the time wheel. The time wheel, through its circular queue and array structure, makes the addition of task queues efficient, reduces the waste of CPU resources, improves the accuracy and execution efficiency of task scheduling, and enhances the scalability of task scheduling.
[0081] S3. Execute the task queue stored in the time slot according to a preset time wheel execution rule.
[0082] In an embodiment of the present invention, the time wheel execution rules include expiration processing and task cancellation of task queues. Expiration processing means that when the execution time of a task queue is less than or equal to the time slot pointed to by the current time wheel pointer, the task queue is regarded as an "expired" task; task cancellation means that when a task queue needs to be cancelled, the index of the task queue is removed from the time slot where it is located.
[0083] In an embodiment of the present invention, executing the task queue stored in the time slot according to a preset time wheel execution rule includes:
[0084] The task queue is marked according to the delay time of the task queue to obtain an expired task queue and a task cancellation queue;
[0085] The pointer of the time wheel in the time wheel execution rule points to the execution of the expired task queue and the task cancellation queue.
[0086] In detail, the time wheel will move forward at a predetermined speed (such as one grid per second). When the time wheel pointer points to the task queue execution time, it will trigger the execution of all task queues in the time slot. During this process, it is necessary to manage the rotation of the time wheel and ensure that the execution of the task queue is triggered at the correct time.
[0087] The present invention classifies and marks expired tasks and cancelled tasks through a preset delay time identifier of a task queue, thereby effectively managing the task queue, avoiding the execution of invalid or no longer needed task queues, and improving task execution efficiency.
[0088] In an embodiment of the present invention, the pointer of the time wheel in the time wheel execution rule points to the execution of the expired task queue and the task cancellation queue, including:
[0089] Rotate the time wheel at a preset speed to obtain the pointer direction of the time wheel;
[0090] When the pointer points to the expired task queue or the task cancellation queue, the expired task queue is executed and the index of the task cancellation queue is removed.
[0091] In detail, suppose the current time is 10 a.m., but there is a "Weekend Special" activity task queue that is mistakenly added to the preset scheduling system, and its execution time is set to 9 a.m. Since the current time has passed, depending on the implementation, the "Weekend Special" activity task queue is a task in the current time slot (the 10 a.m. time slot) waiting for the next cycle.
[0092] In detail, assuming that for some reason, the "Lucky Draw upon Full Consumption" activity task needs to be canceled in advance, first find the position of the task in the time slot in the time wheel, and remove the reference to the task from the time slot. When the time wheel pointer moves to the time slot, the activity task will not be executed.
[0093] In the embodiment of the present invention, the overall resource utilization is improved through the expiration processing, and the execution of invalid tasks is avoided and delays are reduced through the task cancellation mechanism, thereby ensuring that tasks can be executed efficiently and accurately according to the scheduled time, thereby improving task execution efficiency.
[0094] In the embodiment of the present invention, executing the task queue stored in the time slot according to the preset time wheel execution rule can ensure the consistency and accuracy of the task queue, help balance the load, and thus improve the task management efficiency and task execution efficiency.
[0095] The present invention splits the scheduling tasks into task queues and allocates them to time slots in a time wheel to simplify the task scheduling process, thereby reducing the complexity of task scheduling and effectively avoiding time conflicts; the status of the task queue is updated according to the delay time of the task queue, and the updated task queue is stored in the time slot of the time wheel, thereby improving the accuracy and efficiency of task scheduling and enhancing the scalability of task scheduling; the task queue stored in the time slot is executed according to the preset time wheel execution rules, which can improve the overall resource utilization, thereby effectively improving the task management efficiency and task execution efficiency.
[0096] like Figure 2 , which is a schematic diagram of the structure of a task delay processing device provided by an embodiment of the present disclosure.
[0097] The task delay processing device described in the present invention comprises:
[0098] A task allocation module receives a scheduled task, splits the scheduled task into task queues, and allocates the task queues to time slots in a time wheel;
[0099] A task storage module updates the state of the task queue according to the delay time of the task queue, and stores the updated task queue in the time slot of the time wheel;
[0100] The task execution module executes the task queue stored in the time slot according to a preset time wheel execution rule.
[0101] The task delay processing device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the task delay processing device 100 may include a task allocation module 101, a task storage module 102, and a task execution module 103. The module of the present invention may also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0102] In this embodiment, the functions of each module / unit are as follows:
[0103] The task allocation module 101 is used to receive a scheduled task, split the scheduled task into task queues, and allocate the task queues to time slots in a time wheel;
[0104] The task storage module 102 is used to update the state of the task queue according to the delay time of the task queue, and store the updated task queue in the time slot of the time wheel;
[0105] The task execution module 103 is used to execute the task queue stored in the time slot according to a preset time round execution rule.
[0106] The task allocation module 101 is used to receive a scheduled task, split the scheduled task into task queues, and allocate the task queues to time slots in a time wheel.
[0107] Each module in the task delay processing device 100 of the embodiment of the present invention is used in the same manner as described above. Figure 1 to Figure 2 The task delay processing method described in the present invention has the same technical means and can produce the same technical effects, so it will not be repeated here.
[0108] On the basis of the above embodiments, this embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described in the above embodiments.
[0109] like Figure 3 , is a schematic diagram of the structure of an electronic device for implementing a method for delaying task processing provided by an embodiment of the present disclosure.
[0110] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a liveness detection program.
[0111] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a liveness detection program, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0112] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can be used not only to store application software and various types of data installed in the electronic device, such as the code of a liveness detection program, but also to temporarily store data that has been output or is to be output.
[0113] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0114] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0115] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0116] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0117] The liveness detection program stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0118] Receive a scheduled task, split the scheduled task into task queues, and assign the task queues to time slots in a time wheel;
[0119] Update the state of the task queue according to the delay time of the task queue, and store the updated task queue in the time slot of the time wheel;
[0120] The task queue stored in the time slot is executed according to a preset time wheel execution rule.
[0121] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0122] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and apparatuses can be implemented in other ways. For example, the system embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0123] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0124] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0125] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0126] In some implementations of this embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the above embodiment are implemented.
[0127] The readable storage medium of the present invention stores a computer program, and when the computer program is executed by a processor of an electronic device, the above steps S1-S3 can be implemented.
[0128] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0129] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0130] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0131] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0132] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0133] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0134] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0135] The processor of the present invention may include, but is not limited to, one or more processors or microprocessors. Each processor may be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components to implement the method in the above embodiment.
[0136] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, and the computer-readable storage medium may include but is not limited to, for example, random access memory (RAM), read-only memory (ROM), flash memory, EPROM memory, EEPROM memory, registers, computer storage media (e.g., hard disk, floppy disk, solid-state drive, removable disk, CD-ROM, DVD-ROM, Blu-ray disc, etc.).
[0137] The computer-readable storage medium may also store at least one computer executable program / instruction, which may be, for example, a computer-readable instruction. The computer-readable storage medium includes, but is not limited to, for example, a volatile memory and / or a non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The computer-readable storage medium may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. For example, a non-transitory computer-readable storage medium may be connected to a computing device such as a computer, and then, when the computing device runs the computer-readable instructions stored on the computer-readable storage medium, the various methods described above may be performed.
[0138] In addition, the computer device may also include (but not limited to) a data bus, an input / output (I / O) bus, a display, and input / output devices (eg, keyboard, mouse, speaker, etc.), etc.
[0139] The processor may communicate with external devices via an I / O bus via a wired or wireless network.
[0140] In one embodiment, the at least one computer executable instruction may also be compiled into or constitute a software product / computer program product, wherein one or more computer executable instructions are executed by a processor to perform the various functions and / or method steps in the embodiments described in the present technology.
[0141] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0142] It should be noted that in the present disclosure, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element limited by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0143] It should be noted that if software tools or components other than those of our company appear in the embodiments of the present application, they are only used for illustrative purposes and do not represent actual use.
[0144] Although the embodiments disclosed in the present disclosure are as above, the above contents are only embodiments adopted for facilitating the understanding of the present disclosure and are not intended to limit the present disclosure. Any technician in the technical field to which the present disclosure belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in the present disclosure, but the scope of patent protection of the present disclosure shall still be subject to the scope defined in the attached claims.
Claims
1. A method for implementing task delay processing, characterized in that: The method comprises: Receive a scheduled task, split the scheduled task into task queues, and assign the task queues to time slots in a time wheel; Update the state of the task queue according to the delay time of the task queue, and store the updated task queue in the time slot of the time wheel; The task queue stored in the time slot is executed according to a preset time wheel execution rule.
2. A method for implementing task delay processing as claimed in claim 1, characterized in that: The step of splitting the scheduling task into task queues includes: Divide the scheduling task according to the preset task queue granularity to obtain multiple subtasks; The subtasks are arranged into a task queue according to priority attributes of the multiple subtasks.
3. A method for implementing task delay processing as claimed in claim 1, characterized in that: The allocating the task queue to the time slot in the time wheel includes: Calculate the time slot index corresponding to the task queue according to the execution time of the task queue; The task queues are sequentially placed into the time slots in the time wheel according to the time slot indexes.
4. A method for implementing task delay processing as claimed in claim 1, characterized in that: The updating of the state of the task queue according to the delay time of the task queue includes: Get the delay time of the task queue; Determine the state of the task queue according to the delay time to obtain a delay queue; The priority of the delay queue is adjusted to obtain a target task queue.
5. A method for implementing task delay processing as claimed in claim 1, characterized in that: The step of storing the updated task queue into a time slot in a time wheel includes: Calculate the time slot index corresponding to the target task queue according to the delay time of the target task queue; The target task queue is added to the time slot according to the time slot index.
6. A method for implementing task delay processing as claimed in claim 1, characterized in that: The executing the task queue stored in the time slot according to the preset time wheel execution rule includes: The task queue is marked according to the delay time of the task queue to obtain an expired task queue and a task cancellation queue; The pointer of the time wheel in the time wheel execution rule points to the execution of the expired task queue and the task cancellation queue.
7. A method for implementing task delay processing as claimed in claim 1, characterized in that: The pointer of the time wheel in the time wheel execution rule points to the execution of the expired task queue and the task cancellation queue, including: Rotate the time wheel at a preset speed to obtain the pointer direction of the time wheel; When the pointer points to the expired task queue or the task cancellation queue, the expired task queue is executed and the index of the task cancellation queue is removed.
8. A task delay processing device, characterized in that: The device comprises: A task allocation module, used for receiving a scheduled task, splitting the scheduled task into task queues, and allocating the task queues to time slots in a time wheel; A task storage module, used for updating the state of the task queue according to the delay time of the task queue, and storing the updated task queue in the time slot of the time wheel; The task execution module is used to execute the task queue stored in the time slot according to a preset time wheel execution rule.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a method for implementing task delay processing as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, a method for implementing task delay processing as claimed in any one of claims 1 to 7 is implemented.