Task processing method, medium and electronic equipment

By obtaining and utilizing the current count value and non-uniform waiting time interval of the preset cache counter, we pull and process pending messages from the message queue, solving the problem of long waiting time for users to join the group in frequency-limited scenarios, and achieving more efficient task processing and user experience.

CN120144336APending Publication Date: 2025-06-13KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510300866.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In the scenario of frequency restriction, how to invite users to join the group more efficiently, reduce users' waiting time, and improve user experience.

Method used

By obtaining the current count value of the preset cache counter, the waiting time for the next task is determined, the pending messages are pulled from the message queue using non-uniform time intervals, and the related tasks are processed, so as to achieve efficient processing of the task.

Benefits of technology

In the private domain scenario where task frequency is limited, redis cache commands are used to efficiently process pending messages in the message queue, achieving more efficient task processing and user batch group operation, improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120144336A_ABST
    Figure CN120144336A_ABST
Patent Text Reader

Abstract

The invention provides a task processing method, a medium and electronic equipment, and the method comprises the steps: obtaining a current count value of a preset cache counter, the current count value being used for indicating the number of times of task execution in a current task period; based on the current count value, the waiting time for executing the next task is determined, and the waiting time interval of each task in one task period is a non-uniform time interval; in response to the moment corresponding to the waiting time interval of the next task and the non-empty message queue, pulling at least one to-be-processed message of which the number does not exceed the preset number from the message queue; and based on the at least one to-be-processed message, executing a group joining operation on the to-be-joined user in the at least one to-be-processed message. According to the technical scheme, under the private domain scene where the task processing frequency is limited, the redis cache command is used for efficiently processing the to-be-processed messages in the message queue, and more efficient user batch group joining operation is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of computer technology and Internet technology, and in particular to a task processing method, medium and electronic device. Background Art

[0002] The private domain scenario is an independent and private space or environment for enterprises to interact with users. It consists of a variety of business scenarios, including one-on-one private chat, group chat, and Moments. Through private domain scenarios, enterprises can continuously strengthen communication with customers and continuously understand customer needs. After the enterprise's service provider (assistant) establishes a one-on-one private chat relationship with the user, it usually invites the user to join the group in order to more efficiently maintain private domain users in the group chat scenario.

[0003] Under the relevant technology, the operation of inviting users to join a group needs to be implemented with the help of a third-party service system, and the third-party service system has a frequency limit on the operation of inviting users to join a group. For example, an enterprise is only allowed to perform the operation of inviting users to join a group three times per minute. As a result, some users have to wait a long time to join the group, affecting the user experience.

[0004] Therefore, how to invite users to join the group more efficiently in a frequency-limited scenario is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to solve the above technical problems, a task processing method, a medium and an electronic device are proposed.

[0006] According to a first aspect of an embodiment of the present disclosure, there is provided a task processing method, characterized by comprising:

[0007] Obtaining a current count value of a preset cache counter, wherein the current count value is used to indicate the number of times a task has been executed in a current task cycle;

[0008] Determine the waiting time for executing the next task based on the current count value, wherein the waiting time is used to indicate the waiting time interval of the next task, wherein the waiting time interval of each task in a task cycle is a non-uniform time interval;

[0009] In response to reaching a time corresponding to the waiting time interval of the next task and the message queue being not empty, pulling at least one to-be-processed message not exceeding a preset number from the message queue;

[0010] Based on the at least one message to be processed, the to-be-processed task in the at least one message to be processed is processed.

[0011] In some optional implementations, before obtaining the current count value of the preset cache counter, the method further includes:

[0012] Obtain the remaining survival time of the preset cache counter;

[0013] In response to the remaining survival time indicating that the preset cache counter needs to be reset, set the count value of the preset cache counter to the initial value.

[0014] In some alternative embodiments, after processing the pending tasks in the at least one pending message, it further includes:

[0015] In response to the task processing result indicating that the task is successfully processed, update the count value of the preset cache counter;

[0016] Repeat the operation of obtaining the remaining survival time of the preset cache counter.

[0017] In some alternative embodiments, after processing the pending tasks in the at least one pending message, it further includes:

[0018] In response to the task processing result indicating that the task is not processed, insert the pulled at least one pending message into the message queue;

[0019] Repeat the operation of obtaining the remaining survival time of the preset cache counter.

[0020] In some alternative embodiments, after updating the count value of the preset cache counter, it further includes:

[0021] In response to the updated count value indicating that the successfully executed pending task is the first task within the current task cycle, determine the remaining time of the preset cache counter based on the waiting time interval for executing the first task within a task cycle and the task cycle length;

[0022] Set the remaining survival time of the preset cache counter to the initial expiration time.

[0023] In some alternative embodiments, the method further includes:

[0024] Read the task execution configuration table, where the waiting time interval for each task within a task cycle is recorded in the task execution configuration table.

[0025] In some alternative embodiments, in response to reaching the moment corresponding to the execution time interval of the next task, it further includes:

[0026] In response to the message queue being empty, repeat the operation of obtaining the remaining survival time of the preset cache counter.

[0027] In some alternative embodiments, the task to be processed is a task of inviting a user to a group.

[0028] According to a second aspect of the embodiments of the present disclosure, a task processing apparatus is provided, including:

[0029] A first acquisition module, configured to acquire a current count value of a preset cache counter, where the current count value is used to indicate the number of tasks that have been executed within a current task cycle;

[0030] A first determination module, configured to determine a waiting time for executing a next task based on the current count value, where the waiting time is used to indicate a waiting time interval for the next task, and where the waiting time interval for each task within a task cycle is a non-uniform time interval;

[0031] A message pulling module, configured to pull at least one message to be processed that does not exceed a preset number from the message queue in response to reaching a moment corresponding to the waiting time interval for the next task and the message queue not being empty;

[0032] A group entry processing module, configured to process the task to be processed in the at least one message to be processed based on the at least one message to be processed.

[0033] In some alternative embodiments, the apparatus further includes:

[0034] A second acquisition module, configured to acquire a remaining survival time of the preset cache counter;

[0035] A first setting module, configured to set the count value of the preset cache counter to an initial value in response to the remaining survival time indicating that the preset cache counter needs to be reset.

[0036] In some alternative embodiments, the apparatus further includes:

[0037] An update module, configured to update the count value of the preset cache counter in response to a task processing result indicating that the task has been successfully processed;

[0038] The second acquisition module is configured to repeatedly execute the operation of acquiring the remaining survival time of the preset cache counter.

[0039] In some alternative embodiments, the apparatus further includes:

[0040] A message processing module, configured to insert the at least one message to be processed that has been pulled into the message queue in response to a task processing result indicating that the task has not been processed;

[0041] The second obtaining module is configured to repeatedly execute the operation of obtaining the remaining survival time of the preset cache counter.

[0042] In some alternative embodiments, the apparatus further includes:

[0043] A second determination module, configured to, in response to the updated count value indicating that the to-be-processed task successfully executed is the first task within the current task cycle, determine the remaining time of the preset cache counter based on the waiting time interval for executing the first task within one task cycle and the task cycle length;

[0044] A second setting module, configured to set the remaining survival time of the preset cache counter to the remaining time.

[0045] In some alternative embodiments, the apparatus further includes: a reading module, configured to read a task execution configuration table, where the waiting time interval for each task within one task cycle is recorded in the task execution configuration table.

[0046] In some alternative embodiments, the apparatus further includes:

[0047] The second obtaining module is configured to, in response to reaching the moment corresponding to the execution time interval of the next task and the message queue being empty, repeatedly execute the operation of obtaining the remaining survival time of the preset cache counter.

[0048] In some alternative embodiments, the to-be-processed task is a task of inviting a user to a group.

[0049] According to a third aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium storing computer program instructions, and when the computer program instructions are executed, the above task processing method is implemented.

[0050] According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic device, where the electronic device includes:

[0051] A memory, configured to store a computer program product;

[0052] A processor, configured to execute the computer program product stored in the memory, and when the computer program product is executed, the above task processing method is implemented.

[0053] According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product including computer program instructions, and when the computer program instructions are executed by a processor, the above task processing method is implemented.

[0054] Based on the above embodiments of the present disclosure, when task processing is required in the private domain scenario, obtain the current count value of the preset cache counter, and determine the waiting time for executing the next task based on this count value. Among them, the waiting times corresponding to different count values are non-uniform. When the time corresponding to the execution time interval of the next task arrives and the message queue is not empty, pull at least one message to be processed not exceeding the preset number from the message queue, and process the tasks to be processed in at least one message to be processed based on the at least one message to be processed. Thus, the technical solution of the present disclosure realizes the efficient processing of messages to be processed in the message queue by using redis cache commands in the private domain scenario where the task processing frequency is restricted, achieving more efficient task processing; in addition, the task scheduling method implemented by using redis operation commands has good readability, good migration, and a simple implementation method; and by setting the waiting time interval for each task as a non-uniform time interval, the flexibility of task processing is enhanced.

[0055] The technical solution of the present disclosure will be further described in detail below with reference to the drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] By describing the embodiments of the present disclosure in more detail in conjunction with the drawings, the above and other objects, features, and advantages of the present disclosure will become more obvious. The drawings are used to provide a further understanding of the embodiments of the present disclosure, and constitute a part of the specification, and are used to explain the present disclosure together with the embodiments of the present disclosure, and do not constitute a limitation to the present disclosure. In the drawings, the same reference numerals generally represent the same components or steps.

[0057] Figure 1 It is a flowchart of an embodiment of the task processing method of the present disclosure;

[0058] Figure 2 It is a flowchart of another embodiment of the task processing method of the present disclosure;

[0059] Figure 3 It is a schematic structural diagram of an embodiment of the task processing device of the present disclosure;

[0060] Figure 4 It is a schematic structural diagram of another embodiment of the task processing device of the present disclosure;

[0061] Figure 5 It is a structural diagram of an electronic device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0062] The exemplary embodiments of the present disclosure will be described in detail below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure. It should be understood that the present disclosure is not limited by the exemplary embodiments described herein.

[0063] It should be noted that: Unless otherwise specifically stated, the relative arrangements of components and steps, numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure.

[0064] Those skilled in the art can understand that terms such as "first", "second", etc. in the embodiments of the present disclosure are only used to distinguish different steps, devices, or modules, etc., and neither represent any specific technical meaning nor indicate an inevitable logical order between them.

[0065] It should also be understood that in the embodiments of the present disclosure, "a plurality of" may refer to two or more, and "at least one" may refer to one, two, or more.

[0066] It should also be understood that for any component, data, or structure mentioned in the embodiments of the present disclosure, without clear limitation or contrary indication in the context, it is generally understood as one or more.

[0067] In addition, the term "and / or" in the present disclosure is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in the present disclosure generally represents an "or" relationship between the associated objects before and after.

[0068] It should also be understood that the description of each embodiment in the present disclosure emphasizes the differences between the embodiments, and their similarities or similarities can be referred to each other. For the sake of brevity, they will not be elaborated one by one.

[0069] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn in actual proportional relationships.

[0070] The following description of at least one exemplary embodiment is actually only illustrative and in no way restricts the present disclosure and its application or use.

[0071] Techniques, methods, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the techniques, methods, and devices should be regarded as part of the specification.

[0072] It should be noted that: Similar reference numerals and letters denote similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further discussed in subsequent figures.

[0073] Embodiments of the present disclosure can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate together with many other general or special computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments, and / or configurations suitable for use with electronic devices such as terminal devices, computer systems, or servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, small computer systems, large computer systems, and distributed cloud computing technology environments including any of the above systems, etc.

[0074] Terminal devices, computer systems, servers and other electronic devices can be described in the general context of computer system-executable instructions (such as program modules) executed by a computer system. Generally, program modules may include routines, programs, target programs, components, logic, data structures, etc., which perform specific tasks or implement specific abstract data types. The computer system / server can be implemented in a distributed cloud computing environment. In a distributed cloud computing environment, tasks can be executed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.

[0075] Overview of the present disclosure

[0076] In the process of implementing the present disclosure, the inventors found through research that there are limitations on the processing frequency of task processing in certain scenarios. For example, when inviting users to a group, the third-party service system used has a frequency limit on the operation of inviting users to a group. For example, only 3 group entry operations are allowed per minute; or, when system resources are limited, the frequency of the task of pushing messages to users will also be restricted. For example, only 3 messages are allowed to be pushed to users per minute, etc.

[0077] In the task processing method provided by the present disclosure, the group entry information of the users to be added to the group is inserted into the message queue, and redis commands are used to read multiple tasks to be processed from the message queue at non-uniform time intervals within each task cycle, efficiently execute the tasks, and the implementation method is simple.

[0078] The tasks to be processed in the embodiments of the present disclosure can be various tasks with limited processing frequencies, such as tasks of inviting users to a group and tasks of pushing messages to users. The embodiments of the present disclosure describe the solution with the task of inviting users to a group as the task to be processed, only as an example, rather than a limitation on the task to be processed.

[0079] Exemplary method

[0080] Figure 1 This is a flowchart of an embodiment of the task processing method of the present disclosure. As Figure 1 shown, the method is applied to a customer relationship management platform (computer system, server) in a private domain scenario, and includes steps 101 - 104. Each step will be described separately below.

[0081] In step 101, obtain the current count value of a preset cache counter, where the current count value is used to indicate the number of tasks executed within the current task cycle.

[0082] Among them, the preset cache counter is a counter used to count the number of tasks executed within each task cycle. The count value of the preset cache counter is the key of the preset cache counter. After each successful execution of a task, the count value will increase accordingly. The current count value is used to indicate the number of tasks executed within the current task cycle. For example, if the count value is 0, it means that no task has been successfully executed within the current task cycle.

[0083] In this embodiment, the preset cache counter is a redis counter. The current count value of the preset cache counter can be obtained through the get command of redis, such as cntVal = get(cntKey), where cntVal is the count value and cntKey is the key of the preset cache counter.

[0084] Among them, the length of the task cycle is related to the frequency limit of task processing (such as the operation of inviting users into a group). If the frequency limit of the operation of inviting users into a group is no more than 5 times per minute, the length of the task cycle is 1 minute; if the frequency limit of the operation of inviting users into a group is no more than 3 times per 10 minutes, the length of the task cycle is 10 minutes.

[0085] In step 102, based on the current count value, determine the waiting time for executing the next task, where the waiting time is used to indicate the waiting time interval for the next task. Among them, the waiting time interval for each task within a task cycle is a non-uniform time interval.

[0086] In this embodiment, the waiting time interval for each task within a task cycle is non-uniform. Therefore, the waiting time intervals before executing each task can be different. For example, the number of times a task is allowed to be executed within one minute does not exceed three times, and the waiting time intervals for the three tasks are 5s, 10s, and 45s respectively; or 5s, 5s, and 50s respectively.

[0087] In this embodiment, after a task is successfully executed, the remaining survival time of the redis counter (preset cache counter) is set through an expiration command, thereby enabling full utilization of the task cycle to execute tasks.

[0088] Exemplarily, the waiting time intervals for three tasks are 5s, 10s, and 45s respectively. Before the task is successfully executed, the count value of the preset cache counter is 0. After waiting for 5s, the task execution operation is triggered. If the user group entry operation is successfully executed, the remaining survival time of the redis counter is set to 55 seconds through the expire command (the task period is 60s, the waiting time for the first task is 5s, and the time consumed for task execution is very short, so the remaining survival time of the redis counter is 60s - 5s = 55s).

[0089] In some other embodiments, if the execution of the next task is the last task execution within the current task period, the execution of the next task is not necessarily the preset waiting time interval, and it can be determined based on the remaining survival time of the preset cache counter. For example, if according to the preset waiting time interval, the waiting time interval for the last task is 45s, but when starting to execute the last task, the obtained remaining survival time of the preset cache counter is 42s, then the waiting time interval for the last task is 42s. This implementation method can flexibly determine the waiting time interval of the last task, thereby ensuring that more efficient user batch group entry operations can be achieved in each task period.

[0090] In some embodiments, after determining the waiting time interval, the Redis service process can be paused through a pause execution command, such as the SUSPEND command, and no command requests are processed during the paused time. For example, pause in place for 5s and then execute the next task.

[0091] In some embodiments, after determining the waiting time interval, the thread executing the task can be made to enter the sleep state through a sleep command, such as the sleep command, and the thread is awakened after sleeping for the time corresponding to the above waiting time interval to execute the next task.

[0092] In step 103, in response to reaching the moment corresponding to the waiting time interval of the next task and the message queue not being empty, at least one pending message not exceeding the preset number is pulled from the message queue.

[0093] Among them, the moment corresponding to the waiting time interval of the next task is the trigger moment of the next task. After determining the waiting time interval through step 102, the waiting operation can be implemented through a pause execution command or a sleep command, etc., and after the system clock reaches the moment corresponding to the waiting time interval, the execution of the next task is triggered, that is, at least one pending message not exceeding the preset number is pulled from the message queue.

[0094] Exemplarily, if the waiting time interval is 5s, the execution can be suspended for 5000 milliseconds (5s) through the SUSPEND 5000 command; alternatively, the sleep command can be used to put the thread executing the task into a sleep state and wake up the thread after sleeping for 5s.

[0095] Among them, the message queue stores messages to be processed, and each message to be processed contains the group entry information of the user to be added to the group. The group entry information of the user to be added to the group includes the user identification information and group identification information of the user to be added to the group. The group identification information is a string used to uniquely identify a group chat, and the user identification information is a unique identifier used to identify the user to be added to the group.

[0096] In this embodiment, when a user requests to join a group, the customer relationship management platform in the private domain scenario inserts the corresponding message to be processed into the message queue. It can be understood that in some promotional activity scenarios, there are situations where a large number of users join the group in a short period of time. By inserting the group entry information of the user's request to join the group into the message queue, it helps to reduce the load pressure on the system through asynchronous processing, and the batch group entry method for multiple users through the message queue can also achieve user group entry as efficiently as possible under limited frequencies.

[0097] Among them, the preset number is determined based on the services provided by the system. For example, if the system sets that a single group entry task can only invite no more than 50 users to join the group, the preset number can be set to 50.

[0098] In step 104, based on at least one message to be processed, the tasks to be processed in at least one message to be processed are processed.

[0099] Among them, the task to be processed can be various tasks with limited processing frequencies, such as the operation of inviting users to join the group. Among them, performing a group entry operation on the user to be added to the group is an operation used to indicate adding the user to be added to the group to the group.

[0100] In this embodiment, after obtaining the group entry information of the user to be added to the group from the message to be processed, the group entry information of the user to be added to the group (the user identification information and group identification information of the user to be added to the group) can be sent to the task processor in batches, and the task processor completes the user group entry operation. The present invention does not limit the method for the task processor to complete the user group entry operation.

[0101] Through the above steps 101 - 104, when a task needs to be processed in a private domain scenario, obtain the current count value of a preset cache counter, and determine the waiting time for the next task based on this count value. Among them, the waiting times corresponding to different count values are non-uniform. When the time corresponding to the execution time interval of the next task arrives and the message queue is not empty, pull at least one message to be processed not exceeding a preset number from the message queue, and process the tasks to be processed in at least one message to be processed based on the at least one message to be processed. Thus, the technical solution of the present disclosure realizes the efficient processing of messages to be processed in the message queue by using redis cache commands in a private domain scenario that restricts the frequency of processing tasks, achieving more efficient task processing; in addition, the task scheduling method implemented using redis operation commands has good readability, good migration, and a simple implementation method; and by setting the waiting time interval for each task as a non-uniform time interval, the flexibility of task processing is enhanced.

[0102] Figure 2 It is a flowchart of another embodiment of the task processing method of the present disclosure. As Figure 2 shown, it includes steps 201 - 210, and each step will be described separately below.

[0103] In step 201, obtain the remaining survival time of the preset cache counter.

[0104] Among them, the remaining survival time of the preset cache counter is used to indicate the remaining available time within the current task cycle. After successfully executing a task within the current task cycle, the remaining survival time of the redis counter (preset cache counter) can be set through an expiration command, and a timer is used to time and update this remaining survival time.

[0105] Exemplarily, the cycle length of a task cycle is 1 minute, the number of times a task can be executed in 1 minute is three, the waiting time intervals of the tasks are 5s, 10s, and 45s respectively. Before successfully executing a task, the remaining survival time is 60s. After successfully executing a task once, the remaining survival time becomes (60 - 5) = 55s, and then the remaining survival time is timed and updated through a timer.

[0106] In this embodiment, the remaining survival time of the preset cache counter can be obtained by obtaining the timing time of the timer used to time and update the remaining survival time.

[0107] In step 202, in response to the remaining survival time indicating that the preset cache counter needs to be reset, set the count value of the preset cache counter to the initial value.

[0108] Among them, in response to the remaining survival time indicating that the preset cache counter needs to be reset, the count value of the preset cache counter can be set to the initial value through the sexNx(cntKey, 0, 60) command; if the remaining survival time indicates that the preset cache counter does not need to be reset, then directly execute step 203.

[0109] Among them, when the remaining survival time is 0, it indicates that the current task cycle has ended, and the count value of the preset cache counter needs to be reset. The initial value of the preset cache counter can be 0, which is used to indicate the number of tasks executed within a new task cycle.

[0110] Specifically, the preset cache counter is a redis counter, and the preset cache counter can be set through the sexNx(cntKey, 0, 60) command. Among them, cntKey is the key of the counter, and 60 represents an operation cycle of 60s. Successful setting indicates the start of a new task cycle.

[0111] In step 203, obtain the current count value of the preset cache counter, and the current count value is used to indicate the number of tasks executed within the current task cycle.

[0112] In step 204, based on the current count value, determine the waiting time for the next task execution. The waiting time is used to indicate the waiting time interval for the next task. Among them, the waiting time interval for each task within a task cycle is a non-uniform time interval.

[0113] In step 205, in response to reaching the moment corresponding to the waiting time interval for the next task and the message queue not being empty, pull at least one pending message not exceeding the preset number from the message queue. Each pending message in the at least one pending message includes the group entry information of the user to be added to the group.

[0114] In this embodiment, the specific implementation manners of steps 203 to 205 can be referred to Figure 1 the descriptions of steps 101 to 103 in the embodiment shown, and will not be elaborated here.

[0115] Further, in response to the message queue being empty, it indicates that there is no pending message currently, then repeat step 201 to perform the operation of obtaining the remaining survival time of the preset cache counter. In response to the message queue not being empty, then pull at least one pending message not exceeding the preset number from the message queue, and implement the operation of batch group entry through step 206.

[0116] In step 206, based on the at least one pending message, process the pending tasks in the at least one pending message.

[0117] In this embodiment, the specific implementation manner of step 206 can be referred toFigure 1 The description of step 104 in the illustrated embodiment will not be elaborated here.

[0118] Further, in response to the operation result of the group entry operation being successful in joining the group, step 207 is executed; in response to the operation result of the group entry operation being a failure to join the group, step 210 is executed.

[0119] In step 207, in response to the task processing result indicating that the task has been successfully processed, the count value of the preset cache counter is updated.

[0120] Among them, after the group entry operation is executed, the task processing result can be obtained, such as the operation result of the group entry operation. When the operation result of the group entry operation is successful in joining the group, an update operation is performed on the count value of the preset cache counter. Here, the update operation is an increment operation, which is used to indicate that the number of tasks executed in the current task cycle has increased by one.

[0121] Specifically, the incr(cntKey) command can be used to perform an increment operation on the key of the preset cache counter.

[0122] In step 208, in response to the updated count value indicating that the pending task successfully executed is the first task in the current task cycle, based on the waiting time interval for executing the first task in a task cycle and the task cycle length, the remaining time of the preset cache counter is determined.

[0123] Among them, if the updated count value indicates that the first task in the current task cycle has been successfully executed. For example, if the initial value of the preset cache counter is 0 and the updated count value is 1, it indicates that the first task in the current task cycle has been successfully executed. The remaining time of the preset cache counter is used to indicate the set initial remaining survival time, which can be calculated based on the waiting time interval for the first task and the task cycle length.

[0124] In this embodiment, the task execution configuration table can be read. The task execution configuration table records the waiting time interval for each task in a task cycle, and the waiting time interval for each task in the task cycle is obtained. For example, three tasks can be executed in a task cycle, and the waiting time interval for each task is preset to 5s, 5s, and 50s. Then, the waiting time interval for the first task is 5s.

[0125] Exemplarily, if the task cycle length of a task cycle is 60s and the waiting time interval for the first task is 5s, then the remaining time of the preset cache counter is (60 - 5) = 55s.

[0126] In step 209, using the expiration command, the remaining survival time of the preset cache counter is set to the remaining time.

[0127] Among them, the invalidation command can be the expire command. For example, by expire(cntKey, 55), the remaining survival time of the redis counter can be set to 55 seconds.

[0128] In some other embodiments, the expiration time of cntKey can also be specified through the SET command. The command format can be SET key value EX seconds, where key is the key name, value is the value of the key, and seconds is the expiration time in seconds.

[0129] In step 210, in response to the task processing result indicating that the task has not been processed, at least one unprocessed message pulled is inserted into the message queue.

[0130] In this embodiment, if the task processing result indicates that the task has not been processed. For example, if the operation result of the group entry operation is a failure to enter the group, it indicates that the processing of the unprocessed message pulled from the message queue fails, and the user waiting to enter the group cannot enter the group. Then, at least one unprocessed message pulled needs to be inserted into the message queue and wait to be processed later.

[0131] Furthermore, repeat step 201, perform the operation of obtaining the remaining survival time of the preset cache counter, and start the execution of the next task.

[0132] Through the above steps 201 - 210, in the private domain scenario, obtain the current count value of the preset cache counter, and based on this count value, determine the waiting time for the execution of the next task. Among them, the waiting times corresponding to different count values are non-uniform. When the time corresponding to the execution time interval of the next task arrives and the message queue is not empty, pull at least one unprocessed message not exceeding the preset number from the message queue, and based on the at least one unprocessed message, perform the group entry operation on the users waiting to enter the group in the at least one unprocessed message. Thus, the technical solution of the present disclosure realizes the efficient processing of the unprocessed messages in the message queue by using the redis cache command in the private domain scenario where the processing task frequency is restricted, and realizes a more efficient batch group entry operation for users; in addition, the task scheduling method implemented by using the redis operation command has good readability, good migration, and simple implementation; and by setting the waiting time interval for each task as a non-uniform time interval, the flexibility of task execution is enhanced; in addition, by adopting a non-uniform waiting time interval, rapid operation and processing are carried out in the early stage of a task cycle, making the user experience better; and after the first task has been successfully executed within the current task cycle, then based on the waiting time interval for the execution of the first task within a task cycle and the length of the task cycle, determine the remaining time (remaining survival time) of the preset cache counter, then it can realize a more efficient batch invitation of users to enter the group within a task cycle.

[0133] Exemplary device

[0134] Figure 3 Schematic diagram of a structure of an embodiment of a task processing device of the present disclosure. As Figure 3 shown, the device includes:

[0135] A first acquisition module 31, configured to acquire a current count value of a preset cache counter, where the current count value is used to indicate the number of tasks executed within the current task cycle;

[0136] A first determination module 32, configured to determine a waiting time for executing the next task based on the current count value, where the waiting time is used to indicate the waiting time interval for the next task, and where the waiting time interval for each task within one task cycle is a non-uniform time interval;

[0137] A message pulling module 33, configured to pull at least one message to be processed not exceeding a preset number from a message queue in response to the arrival of a moment corresponding to the waiting time interval for the next task and when the message queue is not empty;

[0138] A group entry processing module 34, configured to process the tasks to be processed in at least one message to be processed based on the at least one message to be processed.

[0139] Figure 4 Schematic diagram of a structure of another embodiment of a task processing device of the present disclosure. As Figure 4 shown, based on the embodiment shown in Figure 3 In some further optional implementation manners of the present disclosure, the device further includes:

[0140] A second acquisition module 35, configured to acquire the remaining survival time of a preset cache counter;

[0141] A first setting module 36, configured to set the count value of the preset cache counter to an initial value in response to the remaining survival time indicating that the preset cache counter needs to be reset.

[0142] In some further optional implementation manners of the present disclosure, the device further includes:

[0143] An update module 37, configured to update the count value of the preset cache counter when the task processing result indicates that the task is successfully processed;

[0144] A second acquisition module 35, configured to repeatedly execute the operation of acquiring the remaining survival time of the preset cache counter.

[0145] In some further optional implementation manners of the present disclosure, the device further includes:

[0146] The message processing module 38 is configured to represent that the task has not been processed for the task processing result, and insert at least one message to be processed pulled into the message queue;

[0147] The second acquisition module 35 is configured to repeatedly execute the operation of acquiring the remaining survival time of the preset cache counter.

[0148] In some further alternative embodiments of the present disclosure, the apparatus further includes:

[0149] The second determination module 39 is configured to, in response to the updated count value representing that the to-be-processed task successfully executed is the first task within the current task cycle, determine the remaining time of the preset cache counter based on the waiting time interval for executing the first task within one task cycle and the task cycle length;

[0150] The second setting module 40 is configured to set the remaining survival time of the preset cache counter to the initial expiration time.

[0151] In some further alternative embodiments of the present disclosure, the apparatus further includes: a reading module 41 configured to read a task execution configuration table, where the waiting time interval for each task within one task cycle is recorded in the task execution configuration table.

[0152] In some further alternative embodiments of the present disclosure, the apparatus further includes:

[0153] The second acquisition module 35 is configured to, in response to reaching the moment corresponding to the execution time interval of the next task and the message queue being empty, repeatedly execute the operation of acquiring the remaining survival time of the preset cache counter.

[0154] In some alternative embodiments, the to-be-processed task is a task of inviting a user to a group.

[0155] The apparatus according to the embodiments of the present disclosure can be used to implement the methods of the above various embodiments of the present disclosure. There is a corresponding relationship in specific implementation between the two, and the specific implementation of the relevant parts is mutually referred to and will not be elaborated here.

[0156] Exemplary electronic device, computer program product, computer-readable storage medium, and system

[0157] The embodiments of the present disclosure further provide an electronic device, including: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, implementing the task processing method of any one of the above embodiments of the present disclosure.

[0158] The embodiments of the present disclosure further provide a task processing system, which includes a customer relationship management platform and a target cloud terminal, and the system is used to implement the task processing method of any one of the above embodiments of the present disclosure.

[0159] Next, referring toFigure 5 Describe an electronic device according to an embodiment of the present disclosure, in which a device for implementing the method of the embodiment of the present disclosure can be integrated. Figure 5 The structural diagram of the electronic device provided by an illustrative embodiment of the present disclosure is as Figure 5 shown. The electronic device includes one or more processors 51, a memory 52 of one or more computer-readable storage media, and a computer program stored on the memory and executable on the processor. When executing the program of the memory 52, the above task processing method can be implemented.

[0160] Specifically, in practical applications, the electronic device may further include components such as an input device 53 and an output device 54. These components are interconnected through a bus system and / or other forms of connection mechanisms (not shown). Those skilled in the art can understand that Figure 5 the structure of the electronic device shown in

[0161] does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or certain components, or different component arrangements. Among them:

[0162] The processor 51 may be a central processing unit (CPU) or other forms of processing units with task processing capabilities and / or instruction execution capabilities. By running or executing software programs and / or modules stored in the memory 52, and calling data stored in the memory 52, various functions are executed and data is processed, thereby overall monitoring the electronic device.

[0163] The input device 53 can be used to receive input digital or character information. The input device 53 may include a keyboard, a mouse, a joystick, etc. related to user settings and function control.

[0164] The output device 54 can output various information to the outside, including the determined distance information, direction information, etc. The output device 54 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.

[0165] The electronic device may further include a power supply for powering various components, which may be logically connected to the processor 51 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, a power status indicator, etc.

[0166] Of course, for simplicity, Figure 5 only some of the components related to the present disclosure in the electronic device are shown, and components such as buses, input / output interfaces, etc. are omitted. In addition, according to specific application scenarios, the electronic device may further include any other appropriate components.

[0167] In addition to the above methods and devices, embodiments of the present disclosure may also be computer program products, which include computer program instructions that cause a processor to execute the steps in the task processing methods according to various embodiments of the present disclosure described in the above "Exemplary Methods" section of this specification when the computer program instructions are run by the processor.

[0168] The computer program product may be written in any combination of one or more programming languages for programming code to perform the operations of the embodiments of the present disclosure. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The programming code may be executed entirely on the user computing device, partially on the user device, executed as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0169] Furthermore, embodiments of the present disclosure may also be computer-readable storage media, on which computer program instructions are stored, and the computer program instructions cause a processor to execute the steps in the task processing methods according to various embodiments of the present disclosure described in the above "Exemplary Methods" section of this specification when the computer program instructions are run by the processor.

[0170] A computer-readable storage medium may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0171] The basic principles of the present disclosure have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, benefits, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, benefits, effects, etc. are essential for each embodiment of the present disclosure. In addition, the above-described specific details are only for illustrative and facilitating understanding purposes, and not for limitation. The above details do not limit the present disclosure to necessarily adopt the above specific details for implementation.

[0172] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference may be made to each other. For system embodiments, since they basically correspond to method embodiments, the description is relatively simple, and reference may be made to the relevant parts of the method embodiments for the relevant content.

[0173] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other various media that can store program codes.

[0174] The methods and apparatuses of the present disclosure may be implemented in many ways. For example, the methods and apparatuses of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is only for illustration, and the steps of the method of the present disclosure are not limited to the above specifically described order, unless otherwise specifically stated. In addition, in some embodiments, the present disclosure may also be implemented as a program recorded in a recording medium, and these programs include machine-readable instructions for implementing the methods according to the present disclosure. Therefore, the present disclosure also covers a recording medium storing a program for executing the methods according to the present disclosure.

[0175] The description of the present disclosure has been presented for purposes of illustration and description, and is not intended to be exhaustive or to limit the disclosure to the forms disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments were chosen and described in order to best explain the principles of the disclosure and its practical application, and to enable others of ordinary skill in the art to understand the disclosure and design various embodiments with various modifications suited to particular purposes.

Claims

1. A task processing method, characterized in that: include: Obtaining a current count value of a preset cache counter, wherein the current count value is used to indicate the number of times a task has been executed in a current task cycle; Determine the waiting time for executing the next task based on the current count value, wherein the waiting time is used to indicate the waiting time interval of the next task, wherein the waiting time interval of each task in a task cycle is a non-uniform time interval; In response to reaching a time corresponding to the waiting time interval of the next task and the message queue being not empty, pulling at least one to-be-processed message not exceeding a preset number from the message queue; Based on the at least one message to be processed, the to-be-processed task in the at least one message to be processed is processed.

2. The method according to claim 1, characterized in that Before obtaining the current count value of the preset cache counter, the method further includes: Obtaining the remaining survival time of the preset cache counter; In response to the remaining survival time indicating that the preset cache counter needs to be reset, the count value of the preset cache counter is set to an initial value.

3. The method according to claim 2, characterized in that After processing the to-be-processed task in the at least one to-be-processed message, the method further includes: In response to the task processing result indicating that the task is successfully processed, updating the count value of the preset cache counter; Repeat the operation of obtaining the remaining survival time of the preset cache counter.

4. The method according to claim 2, characterized in that: After processing the to-be-processed task in the at least one to-be-processed message, the method further includes: In response to the task processing result indicating that the task has not been processed, inserting the pulled at least one to-be-processed message into the message queue; Repeat the operation of obtaining the remaining survival time of the preset cache counter.

5. The method according to claim 3, characterized in that: After the count value of the preset cache counter is updated, the method further includes: In response to the updated count value indicating that the successfully executed task to be processed is the first task in the current task cycle, based on the waiting time interval for executing the first task in a task cycle and the task cycle length, determining the remaining time of the preset cache counter; The remaining survival time of the preset cache counter is set to the remaining time by using an invalidation command.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The task execution configuration table is read, wherein the task execution configuration table records the waiting time interval of each task in a task cycle.

7. The method according to any one of claims 2 to 6, characterized in that: The step of responding to the time corresponding to the execution time interval of the next task also includes: In response to the message queue being empty, the operation of obtaining the remaining survival time of the preset cache counter is repeatedly performed.

8. The method according to any one of claims 1 to 7, characterized in that: The task to be processed is a task of inviting users to join a group.

9. An electronic device, comprising: a memory for storing a computer program product; A processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, it implements the method described in any one of claims 1 to 8.

10. A computer program product comprising computer program instructions, characterized in that When the computer program instructions are executed by a processor, the method described in any one of claims 1 to 8 is implemented.