Rectification task distribution equipment capable of monitoring in real time and distribution method thereof
By using a multi-threaded dispatch method controlled by semaphores, the problem of excessively long dispatch time in a single-machine, single-threaded manner is solved, achieving a linear increase in the list dispatch rate and flexible performance expansion to meet business needs.
Patent Information
- Application Number
- CN202511471446.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-01-06
AI Technical Summary
In existing technologies, the list distribution process is a single-machine, single-threaded synchronous operation, which results in excessively long distribution times, making it difficult to meet business timeliness requirements and leading to low distribution efficiency.
A multi-threaded dispatch method using semaphores is adopted. The number of threads is determined by detecting the total number of semaphores, the threads are called to perform list dispatch, and the threads are released after completion. The semaphores are reclaimed to update the dispatch status, thereby achieving the thread number limit and semaphore reclamation for multi-threaded execution.
Rapidly expand the dispatch rate within the machine's performance range, linearly increase the dispatch rate, and improve performance by sharing semaphores when the machine's performance reaches a bottleneck, thereby meeting business performance requirements.
Smart Images

Figure CN121277643A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a rectification task dispatching device and method capable of real-time monitoring. Background Technology
[0002] The current dispatching method is a single-machine, single-threaded dispatching process, which is synchronous. The average dispatching time per transaction is 300ms. If 50,000 lists need to be dispatched per day, it would take 4.16 hours. The dispatching time is too long and can no longer meet the business requirements for timely dispatching. The list dispatching efficiency is low. Therefore, the existing technology needs to be improved and developed. Summary of the Invention
[0003] The main objective of this invention is to provide a rectification task dispatching device and method that can be monitored in real time, which can effectively solve the problems in the background art.
[0004] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A rectification task dispatching device and its dispatching method that can be monitored in real time, the method includes: upon detecting a list dispatching instruction, reading the total number of semaphores; determining whether there is data to be dispatched; if there is data to be dispatched, calling a thread according to the semaphores, dispatching the list based on the thread, and releasing the thread after dispatching is completed; if there is no data to be dispatched, reclaiming all semaphores and updating the dispatching status.
[0005] Preferably, before reading the total number of semaphores after detecting the list distribution instruction, the process includes: obtaining the distribution parameters set by the business personnel, and triggering the list distribution instruction according to the distribution parameters.
[0006] Preferably, the step of obtaining the distribution parameters set by the business personnel and triggering the list distribution instruction according to the distribution parameters includes: obtaining the distribution list and distribution channel set by the business personnel; entering the corresponding distribution page according to the distribution list and distribution channel; and detecting the business personnel's click operation on the distribution page to trigger the list distribution instruction.
[0007] Preferably, the step of detecting a list dispatch instruction and then reading the total number of semaphores includes: detecting a list dispatch instruction and then reading the total number of semaphores; determining the total number of dispatch threads based on the total number of semaphores.
[0008] Preferably, if there is data to be dispatched, a thread is invoked based on a semaphore, and a list is dispatched based on the thread. After the dispatch is completed, the thread is released, including: if there is data to be dispatched, a semaphore is retrieved, a thread is retrieved from the thread pool based on a semaphore, a list is dispatched based on the thread, and the dispatch interface is invoked to dispatch the list; after the list dispatch is detected to be completed, the semaphore is released, the thread is released, and the thread is returned to the thread pool.
[0009] Preferably, the step of reclaiming all semaphores and updating the dispatch status if there is no data to be dispatched includes: reclaiming all semaphores if there is no data to be dispatched; detecting the release status of semaphores; and updating the dispatch status if it is detected that all semaphores have been released.
[0010] Preferably, the step of retrieving a semaphore if there is data to be dispatched and retrieving a thread from the thread pool based on the semaphore includes: if there is data to be dispatched, issuing a semaphore retrieval instruction and determining whether the semaphore retrieval was successful; if the retrieval was successful, retrieving a thread from the thread pool based on the semaphore; if the retrieval failed, waiting for the semaphore to be released before performing the semaphore retrieval operation.
[0011] Another embodiment of the present invention provides a rectification task dispatching device capable of real-time monitoring. The device includes: a signal reading module for reading the total number of semaphores when a list dispatching instruction is detected; a determination module for determining whether there is data to be dispatched; a thread invocation and dispatching module for invoking a thread based on the semaphores if there is data to be dispatched, dispatching the list based on the thread, and releasing the thread after dispatching is completed; and a signal recycling module for recycling all semaphores and updating the dispatching status if there is no data to be dispatched.
[0012] Preferably, the distribution device includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described list distribution method.
[0013] Another embodiment of the present invention provides a non-volatile computer-readable storage medium storing computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the above-described list distribution method.
[0014] Compared with the prior art, the present invention has the following beneficial effects: In this invention, the list dispatch method in this embodiment controls the number of threads in multi-threaded execution through semaphore control. Simultaneously, semaphore reclamation completes the waiting process for multi-threaded execution results. Within the limits of machine performance, only the number of semaphores needs to be configured to rapidly expand the dispatch rate, which increases linearly. When machine performance reaches a bottleneck, performance can be improved by sharing semaphores. In other words, as the list size increases in the future, simply changing the number of semaphores can exponentially improve performance and meet business performance requirements. Attached Figure Description
[0015] Figure 1 This is a flowchart of a preferred embodiment of a real-time monitoring method for dispatching rectification tasks according to the present invention; Figure 2 This is a schematic diagram of the functional modules of a preferred embodiment of a rectification task dispatching device capable of real-time monitoring according to the present invention. Figure 3 This is a schematic diagram of the hardware structure of a preferred embodiment of a rectification task dispatching device capable of real-time monitoring according to the present invention. Detailed Implementation
[0016] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.
[0017] like Figure 1-3 As shown, a method for assigning rectification tasks that can be monitored in real time is presented. Figure 1 This is a flowchart of a preferred embodiment of a list distribution method according to the present invention. Figure 1 As shown, it includes the following steps: S1. If a list dispatch instruction is detected, the total number of semaphores is read. S2. Determine if there is data to be dispatched. If yes, proceed to step S3; otherwise, proceed to step S4. S3. Call the thread according to the semaphore, perform list dispatch based on the thread, and release the thread after dispatch is completed; S4. Reclaim all semaphores and update the dispatch status.
[0018] In practice, business personnel filter the list to be distributed based on the business scenario and select the distribution channel, which includes but is not limited to SMS, WeChat, and telephone notification. Based on the distribution list and distribution channel, they enter the corresponding distribution page and click the distribution button on the distribution page to trigger the list distribution instruction.
[0019] In one embodiment, upon detecting a list dispatch instruction, the total number of semaphores is read, including: If a list dispatch instruction is detected, the total number of semaphores is read; the total number of dispatch threads is determined based on the total number of semaphores.
[0020] In practice, after detecting the list dispatch instruction, the current total number of semaphores is read, where the semaphores are the semaphores used for dispatching the list. The total number of semaphores can be used to determine the total number of dispatch threads available for dispatching the list.
[0021] In one embodiment, if there is data to be dispatched, a thread is invoked based on a semaphore, and data is dispatched based on the list using the thread. After dispatching is completed, the thread is released, including: If there is data to be dispatched, a semaphore is retrieved, and a thread is retrieved from the thread pool based on the semaphore; the list is dispatched based on the thread, and the dispatch interface is called to dispatch the list. Once the list distribution is complete, release the semaphore, release the thread, and return the thread to the thread pool.
[0022] In practice, if there is data to be dispatched, a semaphore is retrieved to prove that there is a thread available. At this time, a thread is retrieved, and the dispatch process is carried out according to the retrieved thread. The dispatcher interface is called to dispatch. When the list dispatch is completed, the semaphore is released, and the thread is also released and returned to the thread pool. Then, it continues to determine whether there is data to be dispatched.
[0023] In one embodiment, the step of reclaiming all semaphores and updating the dispatch status if there is no data to be dispatched includes: reclaiming all semaphores if there is no data to be dispatched; detecting the release status of semaphores; and updating the dispatch status if it is detected that all semaphores have been released.
[0024] In practice, if no data is detected to be available for distribution, it indicates that the list has been distributed. At this point, all semaphores are reclaimed, and no further thread calls are made. Once all semaphores are released, the reclaiming process is complete. The distribution status is then updated to "distribution complete," thus completing the list distribution operation.
[0025] In one embodiment, if there is data to be dispatched, a semaphore is retrieved, and a thread is retrieved from the thread pool based on the semaphore, including: If there is data to be dispatched, a semaphore retrieval command is issued, and it is determined whether the semaphore retrieval was successful. If the retrieval is successful, a thread is retrieved from the thread pool based on a semaphore; If the semaphore retrieval fails, wait for the semaphore to be released before attempting to retrieve it again.
[0026] In practice, when retrieving a semaphore, it is also necessary to determine the retrieval status of the semaphore. If all semaphores are occupied, the semaphore cannot be retrieved, and the retrieval status is "retrieval failed". It is necessary to wait for the semaphore to be released before performing the retrieval operation again until the semaphore is successfully retrieved. If the retrieval status is "successful", then the thread is retrieved from the thread pool for use in the dispatch list.
[0027] The present invention also provides a specific application embodiment of the list distribution method, the specific steps of which are as follows: start; List of sales personnel to be screened; Sales personnel select distribution channels; Click to distribute; Read the total number of semaphores to determine the total number of dispatch threads; Determine if there is any data to be distributed; If data is to be dispatched, a semaphore is retrieved. If the semaphore is successfully retrieved, a thread is retrieved from the thread pool and dispatched by calling the dispatcher interface. Once the data dispatch is complete, the thread is released and returned to the thread pool. If semaphore retrieval fails, wait for semaphore release; If there is no data to be dispatched, all semaphores are reclaimed, the dispatch status is updated, and the process ends. This embodiment of the list dispatch method, through semaphore control, limits the number of threads in multi-threaded execution. Simultaneously, semaphore reclamation completes the waiting process for multi-threaded execution results. Within the machine's performance range, only the number of semaphores needs to be configured to rapidly expand the dispatch rate, which increases linearly. When machine performance reaches a bottleneck, performance can be improved by sharing semaphores. In other words, as the list size increases in the future, simply changing the number of semaphores can exponentially improve performance and meet business performance requirements. It should be noted that there is no inherent order between the above steps. Those skilled in the art will understand from the description of this embodiment that different embodiments may have different execution orders, i.e., they may be executed in parallel or alternately, etc.
[0028] Another embodiment of the present invention provides a list distribution device, such as Figure 2 As shown, device 1 includes: The signal reading module 11 is used to read the total number of signals when a list dispatch instruction is detected; Module 12 is used to determine whether there is data to be dispatched; The thread invocation and dispatch module 13 is used to invoke a thread based on a semaphore if there is data to be dispatched, to dispatch data based on a list of data, and to release the thread after dispatching is completed. The signal recovery module 14 is used to recover all semaphores and update the distribution status if there is no data to be dispatched. Specific implementation details are available in the method embodiment and will not be repeated here.
[0029] In one embodiment, the device further includes a dispatch instruction triggering module, which is specifically used to: obtain dispatch parameters set by business personnel, and trigger a list dispatch instruction according to the dispatch parameters.
[0030] For specific implementation details, please refer to the method embodiment; they will not be repeated here.
[0031] In one embodiment, the dispatch instruction triggering module is further configured to: Obtain the distribution list and distribution channels set by the business personnel, and enter the corresponding distribution page according to the distribution list and distribution channels; Upon detecting a click on the dispatch button by a business personnel on the dispatch page, a list dispatch instruction is triggered. Specific implementation details are available in the method embodiment and will not be repeated here.
[0032] In one embodiment, the signal reading module 11 is specifically used for: If a list dispatch instruction is detected, the total number of semaphores is read. The total number of dispatch threads is determined based on the total number of semaphores.
[0033] For specific implementation details, please refer to the method embodiment; they will not be repeated here.
[0034] In one embodiment, the thread invocation and dispatch module 13 is specifically used for: If there is data to be dispatched, a semaphore is retrieved, and a thread is retrieved from the thread pool based on the semaphore; the list is dispatched based on the thread, and the dispatch interface is called to dispatch the list. Once the list distribution is complete, release the semaphore, release the thread, and return the thread to the thread pool.
[0035] For specific implementation details, please refer to the method embodiment; they will not be repeated here.
[0036] In one embodiment, the signal recovery module 14 is specifically used for: If there is no data to be dispatched, then reclaim all semaphores; Detect the release status of the signal; If all semaphores are detected to have been released, update the dispatch state.
[0037] For specific implementation details, please refer to the method embodiment; they will not be repeated here.
[0038] In one embodiment, the thread invocation and dispatch module 13 is further configured to: If there is data to be dispatched, a semaphore retrieval command is issued, and it is determined whether the semaphore retrieval was successful. If the retrieval is successful, a thread is retrieved from the thread pool based on a semaphore; If the semaphore retrieval fails, wait for the semaphore to be released before attempting to retrieve it again.
[0039] For specific implementation details, please refer to the method embodiment; they will not be repeated here.
[0040] Another embodiment of the present invention provides an electronic device, such as... Figure 3 As shown, the electronic device 10 includes: One or more processors 110 and memory 120, Figure 3 The following description uses a processor 110 as an example. The processor 110 and the memory 120 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.
[0041] Processor 110 is used to perform various control logics of electronic device 10. It can be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), microcontroller, ARM (Acorn RISC Machine) or other programmable logic device, discrete gate or transistor logic, discrete hardware controls, or any combination of these components. Furthermore, processor 110 can also be any conventional processor, microprocessor, or state machine. Processor 110 can also be implemented as a combination of computing devices, such as a combination of DSP and microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.
[0042] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions corresponding to the list dispatch method in the embodiments of the present invention. The processor 110 executes various functional applications and data processing of the device 10 by running the non-volatile software programs, instructions, and units stored in the memory 120, thereby implementing the list dispatch method in the above method embodiments.
[0043] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store applications required for operating the device and at least one function; and the data storage area may store data created according to the use of the device 10. Furthermore, the memory 120 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include memory remotely located relative to the processor 110, and these remote memories may be connected to the device 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0044] One or more units are stored in memory 120. When executed by one or more processors 110, they perform the list dispatch method in any of the above method embodiments, for example, the method described above. Figure 1 The method steps S1 to S4 are described in the text.
[0045] This invention provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example, to perform the operations described above. Figure 1 Method steps S1 to S4 The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A rectification task dispatching device capable of real-time monitoring, characterized in that: The device comprises a signal reading module for reading the total number of semaphores when a list dispatch instruction is detected; a judgment module for judging whether there is data to be dispatched; a thread calling and dispatching module for calling a thread according to the semaphore if there is data to be dispatched, dispatching the list based on the thread, and releasing the thread after the dispatching is completed; and a signal recycling module for recycling all semaphores and updating the dispatching state if there is no data to be dispatched.
2. The real-time monitoring and rectification task assignment device according to claim 1, characterized in that: The dispatching device comprises at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores instructions executable by the at least one processor.
3. A non-transitory computer readable storage medium, comprising: The non-volatile computer readable storage medium stores computer executable instructions.
4. A method for assigning rectification tasks that can be monitored in real time, characterized in that: The method comprises reading the total number of semaphores when a list dispatch instruction is detected; judging whether there is data to be dispatched; calling a thread according to the semaphore if there is data to be dispatched, dispatching the list based on the thread, and releasing the thread after the dispatching is completed; and recycling all semaphores and updating the dispatching state if there is no data to be dispatched.
5. The method of claim 4, wherein the method further comprises: Before the reading of the total number of semaphores when a list dispatch instruction is detected, the method comprises obtaining dispatching parameters set by a business staff, and triggering a list dispatch instruction according to the dispatching parameters.
6. The real-time monitorable rectification task assignment device and its assignment method according to claim 5, characterized in that: The obtaining of the dispatching parameters set by the business staff and the triggering of the list dispatch instruction according to the dispatching parameters comprise obtaining a dispatching list and a dispatching channel set by the business staff, and entering a corresponding dispatching page according to the dispatching list and the dispatching channel; and detecting a dispatching button click operation of the business staff on the dispatching page to trigger the list dispatch instruction.
7. The real-time monitoring rectification task assignment device and its assignment method according to claim 4, characterized in that: The reading of the total number of semaphores when a list dispatch instruction is detected comprises reading the total number of semaphores when a list dispatch instruction is detected; and determining the total number of threads according to the total number of semaphores.
8. The real-time monitorable rectification task assignment device and its assignment method according to claim 7, characterized in that: The calling of a thread according to the semaphore if there is data to be dispatched, the dispatching of the list based on the thread, and the releasing of the thread after the dispatching is completed if there is data to be dispatched comprise taking out one semaphore, taking out one thread in a thread pool according to one semaphore if there is data to be dispatched; dispatching the list according to the thread by calling a dispatching interface; detecting that the dispatching of the list is completed, releasing the semaphore, releasing the thread, and returning the thread to the thread pool.
9. The real-time monitorable rectification task assignment device and its assignment method according to claim 8, characterized in that: The recycling of all semaphores and the updating of the dispatching state if there is no data to be dispatched comprise recycling all semaphores if there is no data to be dispatched; detecting the release of the semaphores; and updating the dispatching state if it is detected that all semaphores are released.
10. The real-time monitorable rectification task assignment device and its assignment method according to claim 8, characterized in that: The taking out of one semaphore and the taking out of one thread in the thread pool according to one semaphore if there is data to be dispatched comprise issuing a semaphore taking out instruction if there is data to be dispatched, judging whether the taking out of the semaphore is successful; taking out one thread in the thread pool according to one semaphore if the taking out is successful; and waiting for the release of the semaphore and then performing the semaphore taking out operation again if the taking out fails.