Task processing method and device, electronic equipment and storage medium

By verifying the uniqueness of threads to be processed, the problem of duplicate subscription in the automatic subscription service is solved, ensuring the unique processing of tasks is ensured, user rights are protected, and efficient automatic subscription management is achieved.

CN119597496APending Publication Date: 2025-03-11BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411460133.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the automatic subscription service scenario, how to avoid duplicate subscriptions of the same service and prevent user rights and property losses.

Method used

By obtaining the current pending task and uniquely verifying the current thread based on the task details, ensuring that only one thread processes the current pending task, avoiding duplicate processing and duplicate subscriptions.

Benefits of technology

It effectively avoids duplicate processing of pending tasks and duplicate subscriptions of the same service, protects users' rights and property, and realizes flexible and efficient management of automatic subscription services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597496A_ABST
    Figure CN119597496A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a task processing method and device, electronic equipment and a storage medium. The method comprises the steps that a current to-be-processed task is acquired; performing uniqueness verification on a current thread allocated to process the current to-be-processed task based on task detail information carried by the current to-be-processed task so as to verify whether the current thread is the unique thread for processing the current to-be-processed task; and under the condition that the current thread passes the uniqueness verification, processing the current to-be-processed task through the current thread. According to the scheme, uniqueness verification is carried out on the current thread for executing the current to-be-processed task to ensure that only one thread executes the current to-be-processed task, so that the phenomenon that the current to-be-processed task is repeatedly processed is effectively avoided, and repeated subscription of the same service is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In real life, users often have the need to subscribe to services from applications. For example, users subscribe to membership benefits provided by the application, and can also choose to automatically subscribe to the next period of service within a certain period of time before the service expires. The automatic subscription service requires the service subscription system to complete the task of automatic subscription service at the agreed time, and it is necessary to avoid repeated subscription to the same service to protect user rights and prevent repeated deductions.

[0003] Therefore, how to avoid repeated subscriptions to the same service is an urgent problem to be solved in the current automatic subscription service scenario. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a task processing method, device, electronic device and storage medium.

[0005] The present disclosure provides a task processing method, the method comprising:

[0006] Get the current pending tasks;

[0007] Performing a uniqueness check on a current thread assigned to process the current task to be processed based on the task details information carried by the current task to be processed, so as to verify whether the current thread is the only thread to process the current task to be processed;

[0008] When the current thread passes the uniqueness check, the current task to be processed is processed by the current thread.

[0009] The present disclosure also provides a task processing device, the device comprising:

[0010] Task acquisition module, used to obtain the current pending tasks;

[0011] A verification module, configured to perform a uniqueness verification on a current thread assigned to process the current task to be processed based on the task details information carried by the current task to be processed, so as to verify whether the current thread is the only thread to process the current task to be processed;

[0012] The task execution module is used to process the current task to be processed through the current thread when the current thread passes the uniqueness check.

[0013] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the task processing method provided by the embodiment of the present disclosure.

[0014] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the task processing method provided by the embodiment of the present disclosure.

[0015] The embodiment of the present disclosure also provides a computer program product, which is used to execute the task processing method provided by the embodiment of the present disclosure.

[0016] The technical solution provided by the embodiment of the present disclosure has the following advantages over the prior art: the task processing solution provided by the embodiment of the present disclosure obtains the current pending task and performs a uniqueness check on the current thread assigned to process the current pending task based on the task details information carried by the current pending task, so as to check whether the current thread is the only thread that processes the current pending task. If the current thread passes the uniqueness check, the current pending task is processed by the current thread. The solution of the present disclosure is adopted to perform a uniqueness check on the current thread that is to execute the current pending task to ensure that only one thread is executing the current pending task, thereby effectively avoiding the phenomenon of repeated processing of the current pending task and avoiding repeated subscriptions to the same service. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0018] Figure 1 A flowchart of a task processing method provided by an embodiment of the present disclosure;

[0019] Figure 2 A flowchart of another task processing method provided by an embodiment of the present disclosure;

[0020] Figure 3 A schematic diagram of an interactive process of a task processing method provided in a specific embodiment of the present disclosure;

[0021] Figure 4 A schematic diagram of the structure of a task processing device provided by an embodiment of the present disclosure;

[0022] Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0024] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0025] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0026] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0027] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0029] Automatic renewal services are widely used in e-commerce, software subscriptions, content services, etc. After a user sets an automatic subscription to a service upon expiration, the service subscription system will automatically deduct the service fee from the user's account at the time set by the user.

[0030] Currently, there are some deficiencies in the processing of automatic renewal services, such as duplicate subscription issues, inability to flexibly and effectively handle requests to pause and resume subscriptions, and inability to effectively handle payment failures and downstream dependent service failures. In addition, most systems rely on manual intervention once they encounter problems, resulting in reduced processing efficiency and poor user experience.

[0031] In order to solve the above problems, the embodiment of the present disclosure provides a task processing method, which performs a uniqueness check on the current thread to be executed for the current pending task to ensure that only one thread is executing the current pending task, thereby effectively avoiding the phenomenon of repeated processing of the current pending task, avoiding repeated subscription of the same service, ensuring that the same task is only processed once at a time point, preventing the problem of repeated deduction of paid services, and protecting the rights and property of users. By detecting whether the user has unsubscribed from the service before performing a uniqueness check, the automatic renewal service task can be suspended and resumed at any time. In addition, when the task fails to execute, the execution time of the task is re-determined and published to the message queue to wait for execution, ensuring that the subsequent service subscription system can be restored to a normal state without loss, and ensuring the continuity and consistency of the automatic subscription function. This solution can provide users with flexible and efficient automatic subscription service management, and the usage scenarios include but are not limited to online journal subscriptions for e-commerce web pages, SAAS software subscription services, and membership management of online video platforms.

[0032] The task processing method, device, electronic device and storage medium disclosed in the present invention are explained in detail below in conjunction with specific embodiments.

[0033] Figure 1 A flowchart of a task processing method provided in an embodiment of the present disclosure is provided. The method can be executed by a task processing device provided in an embodiment of the present disclosure, wherein the device can be implemented using software and / or hardware and can generally be integrated into an electronic device. The electronic device integrated with the task processing device can be called a service subscription system.

[0034] like Figure 1 As shown, the task processing method includes:

[0035] Step 101, obtaining the current task to be processed.

[0036] Exemplarily, the current pending tasks may be generated in real time based on the service subscription information. For example, when a user subscribes to a service, if he wants to continue to use the service, he can choose to automatically renew the service for the next term before the current subscription expires. For example, when subscribing to the service for this month or this year, the function of automatically subscribing to the service every month or year thereafter is enabled, and automatic deductions are set one week before the service expires to complete the renewal of the service, until the user actively cancels the subscription to the service. Then, after entering the time point one week before the service expires, the service subscription system generates the current pending tasks based on the service subscription information of this service.

[0037] For example, the service subscription task that needs to be executed currently can be read from the message queue as the current task to be processed. After the service subscription task is generated according to the service subscription information, the service subscription task is published to the message queue, and when the task execution time of a service subscription task in the message queue arrives, the service subscription task is read as the current task to be processed.

[0038] Step 102 : performing a uniqueness check on the current thread assigned to process the current task to be processed based on the task detail information carried by the current task to be processed, so as to check whether the current thread is the only thread to process the current task to be processed.

[0039] Usually, the service subscription system will send the task to the thread for execution. In order to improve the efficiency of task processing, the service subscription system can execute multiple tasks in parallel through multiple threads. In the embodiment of the present disclosure, after obtaining the current pending task, the current pending task will be assigned to a thread (referred to as the current thread), and the current pending task will be executed by the thread. For the current thread assigned to process the current pending task, a uniqueness check can be first performed based on the task details information carried by the current pending task, that is, to check whether the current thread is the only thread that processes the current pending task, that is, to detect whether the current pending task is not executed on other threads. Among them, the task details information may include but is not limited to part or all of the user ID, the subscription service ID of the subscribed service, the subscription service level of the subscribed service, the rights and interests included in the subscribed service, the validity period of the subscription service, and other information.

[0040] As an example, for a scenario where the service subscribed by the current pending task does not distinguish between rights and interests levels, when verifying the uniqueness, the user ID and subscription service ID can be obtained from the task details information of the current pending task, wherein the task details information can be stored in the database with the task number as an index. When verifying the uniqueness, the task details information of the current pending task is obtained from the database according to the task number of the current pending task. The user ID is used to uniquely identify the user, and the subscription service ID is used to uniquely identify the service subscribed by the user. The user ID and subscription service ID of the service subscription task processed on other threads are obtained. If the user ID corresponding to the current pending task is different from the user ID corresponding to the service subscription task processed on other threads, and / or the subscription service ID corresponding to the current pending task is different from the subscription service ID corresponding to the service subscription task processed on other threads, it is determined that no other thread is currently assigned to process the current pending task, that is, it is determined that the current thread is the only thread processing the current pending task, that is, the current thread passes the uniqueness check.

[0041] As another example, for the scenario where the service subscribed by the current pending task has different rights and interests levels, for example, the same application provides service subscriptions of different terms, and the long-term service level is higher than the short-term service level; for another example, the same application provides different levels of services, and the high-level services can enjoy more rights and interests than the low-level services. In this scenario, when verifying the uniqueness, the first user identifier, the first subscription service identifier, and the first subscription service level in the task details information carried by the current pending task can be obtained, and the second user identifier, the second subscription service identifier, and the second subscription service level carried by other subscription service tasks assigned to other threads can be obtained, where other threads refer to threads other than the current thread among all threads used to process subscription service tasks. Next, the first user identifier can be compared with the second user identifier, the first subscription service identifier can be compared with the second subscription service identifier, and the first subscription service level can be compared with the second subscription service level. If the first user identifier is inconsistent with the second user identifier, and / or the first subscription service identifier is inconsistent with the second subscription service identifier, and / or the first subscription service level is higher than the second subscription service level, it is determined that the current task to be processed is different from the subscription service tasks assigned to other threads, and then it is determined that the current thread passes the uniqueness check.

[0042] It should be noted that if there are multiple other threads, the first user identifier, first subscription service identifier and first subscription service level of the current task to be processed need to be compared with the second user identifier, second subscription service identifier and second subscription service level of each other subscription service task respectively. Only when it is determined that the current task to be processed is different from each other subscription service task, can the current thread be determined to have passed the uniqueness check.

[0043] In this embodiment, a uniqueness check is performed on the current thread. The current task to be processed is executed through the current thread only when the current thread passes the uniqueness check. This is equivalent to setting a lock for the processing of the current task to be processed, so that the same task is only processed once at each time point, avoiding repeated processing of tasks.

[0044] Step 103: When the current thread passes the uniqueness check, the current task to be processed is processed by the current thread.

[0045] In the disclosed embodiment, when the current thread passes the uniqueness check, the current task to be processed is processed by the current thread, so that only one thread among the currently running threads processes the current task to be processed, thereby avoiding repeated processing of tasks.

[0046] The task processing method provided by the embodiment of the present disclosure obtains the current pending task and performs a uniqueness check on the current thread assigned to process the current pending task based on the task details information carried by the current pending task, so as to check whether the current thread is the only thread that processes the current pending task. If the current thread passes the uniqueness check, the current pending task is processed by the current thread. The scheme of the present disclosure is adopted, and by performing a uniqueness check on the current thread that is to execute the current pending task, it is ensured that only one thread is executing the current pending task, thereby effectively avoiding the phenomenon of repeated processing of the current pending task and avoiding repeated subscription of the same service.

[0047] For subscription services, users can cancel the automatic subscription service function at any time according to their own needs to give up the automatic renewal of the service for the next term. In some embodiments of the present disclosure, in order to avoid the waste of processing resources caused by unnecessary uniqueness verification when the user has canceled the service subscription, and the property loss caused to the user by continuing to execute the service subscription task after the uniqueness verification is passed, in the embodiments of the present disclosure, before performing a uniqueness verification on the current thread, the current subscription information of the user corresponding to the first user identifier to the subscription service corresponding to the first subscription service identifier can be obtained according to the first user identifier and the first subscription service identifier carried by the current task to be processed; when the current subscription information indicates that the user has subscribed to the subscription service, the step of performing a uniqueness verification on the current thread is performed; when the current subscription information indicates that the user has canceled the subscription service, the current thread is terminated to give up executing the current task to be processed.

[0048] Generally, for the subscription service provided by the application, the user can cancel or resume the subscription at any time. In the embodiment of the present disclosure, the user's request to cancel or resume the subscription is updated to the service subscription system in real time. The service subscription system updates the user's subscription information for the subscription service according to the request to cancel or resume the subscription, wherein the subscription information is to cancel the subscription or to subscribe. In order to distinguish the subscription information of different users for different subscription services, the user identifier, the subscription service identifier and the subscription information can be bound, so that when obtaining the user's subscription information for the subscription service, the query can be based on the user identifier and the subscription service identifier. Therefore, in this embodiment, the service subscription system queries according to the first user identifier and the first subscription service identifier of the current pending task, and can obtain the user indicated by the first user identifier, and the current subscription information (i.e., the latest subscription information) of the subscription service indicated by the first subscription service identifier. If the current subscription information indicates that the user has canceled the subscription service, the current thread is terminated and the execution of the current pending task is stopped; if the current subscription information indicates that the user has subscribed to the subscription service, the current thread is uniquely checked, and after the uniqueness check passes, the current pending task is executed through the current thread.

[0049] In this embodiment, before verifying the uniqueness of the current thread, the user's subscription status to the corresponding subscription service is first obtained to determine whether to cancel the subscription or continue the subscription. The uniqueness check is performed when continuing the subscription. In this way, the automatic renewal service can be paused and resumed at any time, which is highly flexible.

[0050] In some embodiments of the present disclosure, on the basis of the aforementioned embodiments, it is also possible to determine whether the current pending task has been successfully processed by querying the task processing log, and when it is determined that the current pending task is not recorded in the task processing log, or when the task processing log records that the current pending task has been processed but the processing result is a failure, it is determined that the current pending task needs to be executed, and then the current pending task is executed through the current thread.

[0051] Exemplarily, the task processing log records the relevant information of each task that has been processed and the corresponding processing result (success or failure). The relevant information may include user ID, subscription service ID and other information. By querying the record content of the task processing log, it can be determined whether the current pending task has been processed and whether the processing result is failure or success, so as to determine whether the current pending task needs to be executed.

[0052] It can be understood that the operation of querying the task processing log to determine whether the current task to be processed has been successfully processed can be executed at any time before the current task to be processed is processed by the current thread, for example, it can be executed before verifying the uniqueness of the current thread, it can be executed in parallel with the uniqueness check, it can be executed after the uniqueness check passes, and so on. The present disclosure does not impose any restrictions on the timing of determining the execution of the current task to be processed, it only needs to ensure that it is executed before executing the current task to be processed.

[0053] In the disclosed embodiment, the task processing log is queried to determine whether the current pending task has been processed. When the current pending task has not been processed or the processing fails, it is determined that the current pending task needs to be executed, and then the current pending task is executed through the current thread. In this way, repeated processing of tasks can be avoided, thereby avoiding users from repeatedly subscribing to the same service, thereby improving the user experience.

[0054] Furthermore, in some embodiments of the present disclosure, after the current pending task is processed by the current thread, the processing result of the current pending task can also be obtained. For example, the processing result may include but is not limited to success or failure. If the processing result is that the task is executed successfully, the log information that the current pending task has been processed and the processing result is successful is written into the task processing log; if the processing result is that the task fails to execute, the log information that the current pending task has been processed and the processing result is failed is written into the task processing log. Thus, data support is provided for the subsequent detection of whether the subscription service task has been successfully processed.

[0055] In some embodiments of the present disclosure, Figure 2 As shown, based on the above embodiments, the task processing method disclosed in the present invention may further include the following steps:

[0056] Step 201: in response to obtaining a service subscription request of a target user, obtaining service subscription information carried in the service subscription request.

[0057] As an example, when a user needs to subscribe to a service, a service subscription request can be initiated through a corresponding application installed in a mobile terminal, so that the service subscription system can obtain the service subscription request of the user (ie, the target user).

[0058] As another example, when a user has subscribed to a service and turned on the automatic renewal function of the service, the service subscription system can obtain and store the user's subscription information, including but not limited to the user ID, subscription service ID, service validity period (including effective time and expiration time), subscription service level, advance renewal time (for example, one week before expiration), payment institution and other information, and automatically trigger the service subscription request for the service according to the advance renewal time (if any) before the service subscribed by the user expires, or can automatically trigger the service subscription request for the service according to the service expiration time, so that the service subscription system obtains the service subscription request of the target user.

[0059] In the disclosed embodiment, the service subscription request may carry service subscription information such as the target user's user ID, subscription service ID, subscription service level, etc. After the service subscription system obtains the target user's service subscription request, it may extract the service subscription information from the service subscription request.

[0060] Step 202: Determine the target service that the target user requests to subscribe to according to the third subscription service identifier included in the service subscription information.

[0061] In the embodiment of the present disclosure, after the service subscription system obtains the service subscription information, it can extract the subscription service identifier of the requested subscription service (referred to as the third subscription service identifier for ease of description and distinction) from the service subscription information, and then, based on the third subscription service identifier, it can determine the service (referred to as the target service) that the target user requests to subscribe to. It can be understood that in the embodiment of the present disclosure, there is a one-to-one correspondence between the subscription service identifier and the service, and one subscription service identifier uniquely corresponds to one service, so based on the third subscription service identifier, it is possible to determine the target service that the target user requests to subscribe to.

[0062] Step 203, generating a subscription service task according to the task generation rule corresponding to the target service and the service subscription information, wherein the attributes of the subscription service task include task execution time, and the task execution time is determined according to the offset time defined by the task generation rule and the randomly generated time.

[0063] For different services, the corresponding task generation rules may be the same or different. In the embodiment of the present disclosure, the corresponding task generation rules are set for each service in advance, and the corresponding relationship between the service and the task generation rule is established and stored so as to be called when the task needs to be generated. Among them, the task generation rule may include at least one attribute, such as a delay attribute for agreeing on the time interval between tasks, a time period attribute for agreeing on the execution time period of the task (such as 8:00-14:00 every day), and so on. Among them, the attribute value of the delay attribute can be defined as a fixed offset time plus a randomly generated time.

[0064] Thus, in the disclosed embodiment, according to the determined target service, the task generation rule corresponding to the target service can be determined, and then according to the determined task generation rule and service subscription information, the subscription service task is generated, and the attributes of the generated subscription service task include user ID, subscription service ID, subscription service level, task execution time, etc., wherein the basic information such as user ID, subscription service ID, subscription service level can be inherited from the service subscription information, and the task execution time can be determined according to the offset time defined by the task generation rule and the randomly generated time. Specifically, the task execution time of the currently generated subscription service task is equal to the sum of the task execution time of the last generated task plus the offset time defined by the task generation rule plus the randomly generated time.

[0065] In this embodiment, subscription service tasks are generated by pre-defining flexible task generation rules, thereby implementing a self-service renewal strategy in different business scenarios.

[0066] Step 204: publish the subscription service task to a message queue.

[0067] In the disclosed embodiments, the generated subscription service tasks can be published to a message queue to serialize the tasks and wait for execution. By agreeing on the delay time of the subscription service tasks (i.e., the interval time with the last generated task), the subscription service tasks are published to the message queue, and the delay characteristics of the message queue are utilized so that the tasks are automatically and efficiently scheduled within the agreed time. In addition, in some embodiments, each generated subscription service task can also be numbered, and the task number and task details information related to the subscription service task can be stored in a database. The task details information includes but is not limited to the user ID of the user who subscribes to the service, the subscription service ID of the service, the subscription service level, etc.

[0068] Therefore, in this embodiment, when obtaining the current pending task, the current pending task can be read from the message queue according to the task execution time corresponding to each subscription service task in the message queue. In other words, when the task execution time of a subscription service task in the message queue is consistent with the current time of the service subscription system, the subscription service task is read as the current pending task.

[0069] The task processing method of this embodiment obtains the service subscription information carried in the service subscription request in response to obtaining the service subscription request of the target user, determines the target service requested to be subscribed by the target user according to the third subscription service identifier contained in the service subscription information, generates a subscription service task according to the task generation rule and the service subscription information corresponding to the target service, and the attributes of the subscription service task include the task execution time, and the task execution time is determined according to the offset time and the randomly generated time defined by the task generation rule, and then publishes the subscription service task to the message queue. Therefore, by determining the task execution time according to the offset time and the randomly generated time defined by the task generation rule and adding the generated task to the message queue, it is possible to customize the delay time of the task according to the service requirements, and utilize the delay characteristics of the message queue to process the subscription service task, so as to provide users with flexible and efficient automatic renewal management.

[0070] In actual applications, when executing a task, the task execution may fail due to various reasons such as network failure, third-party payment institution failure, etc. In order to ensure that the user successfully subscribes to or renews the service, further, in some embodiments of the present disclosure, after the current pending task is processed by the current thread, if the current pending task fails to execute, the current time is obtained, wherein the current time refers to the current system time of the subscription service system. Then, the new execution time can be determined according to the current time, the offset time, and the randomly generated time, and the task execution time of the current pending task is updated to the new execution time to obtain the updated subscription service task, and then the updated subscription service task is published to the message queue. Therefore, by updating the task execution time of the task and re-publishing the task to the message queue when the task execution fails, the previously failed task can be continued to be executed after the fault is recovered, thereby ensuring the efficient and lossless operation of the service subscription function, and data statistics functions such as withholding orders, data labels, and user churn rates are not affected.

[0071] Figure 3 The interactive flow diagram of the task processing method provided by a specific embodiment of the present disclosure is applied to the automatic renewal scenario when subscribing to a service. Figure 3As shown, the service subscription system includes a task scheduler, a message queue, a task processor, a payment processor and a log server. The user creates a subscription request to request to subscribe to the corresponding paid service. The task scheduler schedules the renewal task generated based on the user's subscription request and publishes it to the message queue. The task processor consumes tasks from the message queue. For the current pending task consumed this time, the task processor obtains the corresponding subscription information from the subscription server to detect whether the user is still subscribed to the service. If the user is still subscribed, the uniqueness of the task is checked. If the uniqueness verification is passed, the log is further queried from the log server. If it is determined that the task is not successfully processed, the subscription server is notified to obtain a lock to lock the task, and then a payment request is sent to the payment processor. The payment processor notifies the external payment server to deduct the payment based on the payment request. The payment processor feeds back the payment result to the task processor according to the deduction result. If the payment is successful, the task processor notifies the subscription server to update the subscription status to "activated". After updating the subscription status, the subscription server records the log "subscription updated" to the log server; if the payment fails, the task processor republishes the task to the message queue. After that, the task processor notifies the subscription server to release the lock and notifies the log server to record the log "task processed". When the user requests to cancel the subscription service, the subscription information obtained by the task processor from the subscription server will instruct the user to cancel the subscription of the corresponding service, and the task scheduler will delete the renewal task. When the user requests to resume the subscription service, the task scheduler will regenerate the renewal task and publish the newly generated task to the message queue for execution.

[0072] Figure 4 FIG. 1 is a schematic diagram of a task processing device provided by an embodiment of the present disclosure, and the device can be implemented by software and / or hardware. Figure 4 As shown, the task processing device 40 includes: a task acquisition module 410 , a verification module 420 and a task execution module 430 .

[0073] The task acquisition module 410 is used to acquire the current task to be processed;

[0074] A verification module 420 is used to perform a uniqueness verification on the current thread assigned to process the current task to be processed based on the task detail information carried by the current task to be processed, so as to verify whether the current thread is the only thread to process the current task to be processed;

[0075] The task execution module 430 is used to process the current task to be processed through the current thread when the current thread passes the uniqueness check.

[0076] Optionally, the verification module 420 is further configured to:

[0077] Obtaining a first user identifier, a first subscription service identifier, and a first subscription service level in task detail information carried by the current task to be processed;

[0078] Obtaining a second user identifier, a second subscription service identifier, and a second subscription service level carried by other subscription service tasks assigned to other threads, wherein the other threads refer to threads other than the current thread among all threads for processing subscription service tasks;

[0079] When the first user identifier is inconsistent with the second user identifier, and / or the first subscription service identifier is inconsistent with the second subscription service identifier, and / or the first subscription service level is higher than the second subscription service level, it is determined that the current thread passes the uniqueness check.

[0080] Optionally, the task processing device 40 further includes:

[0081] A first acquisition module, configured to acquire, according to the first user identifier and the first subscription service identifier, current subscription information of a user corresponding to the first user identifier to a subscription service corresponding to the first subscription service identifier;

[0082] The verification module 420 is further configured to, when the current subscription information indicates that the user has subscribed to the subscription service, execute a step of performing uniqueness verification on the current thread.

[0083] Optionally, the task processing device 40 further includes:

[0084] The termination module is used to terminate the current thread to abandon the execution of the current pending task when the current subscription information indicates that the user cancels the subscription service.

[0085] Optionally, the task processing device 40 further includes:

[0086] A judgment module, used to judge whether the current task to be processed has been processed by querying the task processing log;

[0087] The first determination module is used to determine that the current task to be processed needs to be executed when the current task to be processed is not recorded in the task processing log, or when the task processing log records that the current task to be processed has been processed but the processing result is failure.

[0088] Optionally, the task processing device 40 further includes:

[0089] A processing result acquisition module, used to obtain the processing result of the current task to be processed;

[0090] A log writing module is used to write the log information that the current pending task has been processed and the processing result is successful into the task processing log when the processing result is successful task execution; and to write the log information that the current pending task has been processed and the processing result is failed into the task processing log when the processing result is failed task execution.

[0091] Optionally, the task processing device 40 further includes:

[0092] A second acquisition module, configured to, in response to obtaining a service subscription request of a target user, obtain service subscription information carried in the service subscription request;

[0093] A second determining module, configured to determine the target service that the target user requests to subscribe to according to a third subscription service identifier included in the service subscription information;

[0094] A task generation module, used to generate a subscription service task according to the task generation rule corresponding to the target service and the service subscription information, wherein the attributes of the subscription service task include a task execution time, and the task execution time is determined according to an offset time defined by the task generation rule and a randomly generated time;

[0095] A task publishing module, used to publish the subscription service task to a message queue;

[0096] The task acquisition module 410 is further used to read the current to-be-processed task from the message queue according to the task execution time corresponding to each subscription service task in the message queue.

[0097] Further optionally, the task processing device 40 further includes:

[0098] A third acquisition module is used to obtain the current time when the current task to be processed fails to execute;

[0099] A third determination module, used to determine a new execution time according to the current time, the offset time and the randomly generated time;

[0100] An updating module, used to update the task execution time of the current task to be processed to the new execution time, and obtain an updated subscription service task;

[0101] The task publishing module is also used to publish the updated subscription service task to the message queue.

[0102] The task processing device provided in the embodiments of the present disclosure can execute the task processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0103] In order to implement the above embodiments, the present disclosure further proposes a computer program product, including a computer program / instruction, which implements the task processing method in the above embodiments when executed by a processor.

[0104] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.

[0105] The following specific reference Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. It can be understood that, Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0106] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0107] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0108] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the task processing method of the embodiment of the present disclosure are executed.

[0109] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0110] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0111] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0112] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device performs the functions defined in the task processing method of the embodiment of the present disclosure.

[0113] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0114] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0115] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, constitute a limitation on the unit itself.

[0116] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0117] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0118] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:

[0119] processor;

[0120] a memory for storing instructions executable by the processor;

[0121] The processor is used to read the executable instructions from the memory and execute the instructions to implement any task processing method provided in the present disclosure.

[0122] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute any of the task processing methods provided by the present disclosure.

[0123] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0124] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0125] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A task processing method, characterized in that: include: Get the current pending tasks; Performing a uniqueness check on a current thread assigned to process the current task to be processed based on the task details information carried by the current task to be processed, so as to verify whether the current thread is the only thread to process the current task to be processed; When the current thread passes the uniqueness check, the current task to be processed is processed by the current thread.

2. The method according to claim 1, characterized in that The uniqueness verification of the current thread assigned to process the current task to be processed based on the task detail information carried by the current task to be processed includes: Obtaining a first user identifier, a first subscription service identifier, and a first subscription service level in task detail information carried by the current task to be processed; Obtaining a second user identifier, a second subscription service identifier, and a second subscription service level carried by other subscription service tasks assigned to other threads, wherein the other threads refer to threads other than the current thread among all threads for processing subscription service tasks; When the first user identifier is inconsistent with the second user identifier, and / or the first subscription service identifier is inconsistent with the second subscription service identifier, and / or the first subscription service level is higher than the second subscription service level, it is determined that the current thread passes the uniqueness check.

3. The method according to claim 2, characterized in that Before performing uniqueness verification on the current thread assigned to process the current task to be processed based on the task detail information carried by the current task to be processed, the method further includes: According to the first user identifier and the first subscription service identifier, obtaining current subscription information of the user corresponding to the first user identifier for the subscription service corresponding to the first subscription service identifier; In case the current subscription information indicates that the user is subscribed to the subscription service, a step of performing uniqueness verification on the current thread is performed.

4. The method according to claim 3, characterized in that The method further comprises: In the case where the current subscription information indicates that the user cancels the subscription service, the current thread is terminated to abandon the execution of the current pending task.

5. The method according to any one of claims 1 to 4, characterized in that: Before processing the current task to be processed by the current thread, the method further includes: Determine whether the current pending task has been processed by querying the task processing log; When the current task to be processed is not recorded in the task processing log, or when the task processing log records that the current task to be processed has been processed but the processing result is failure, it is determined that the current task to be processed needs to be executed.

6. The method according to claim 5, characterized in that After processing the current task to be processed by the current thread, the method further includes: Obtaining the processing result of the current task to be processed; When the processing result is that the task is executed successfully, the log information that the current task to be processed has been processed and the processing result is successful is written into the task processing log; When the processing result is that the task execution fails, the log information that the current task to be processed has been processed and the processing result is failure is written into the task processing log.

7. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: In response to obtaining a service subscription request of a target user, obtaining service subscription information carried in the service subscription request; Determining, according to the third subscription service identifier included in the service subscription information, the target service that the target user requests to subscribe to; Generate a subscription service task according to the task generation rule corresponding to the target service and the service subscription information, wherein the attributes of the subscription service task include a task execution time, and the task execution time is determined according to the offset time defined by the task generation rule and the randomly generated time; Publishing the subscription service task to a message queue; The obtaining of the current pending task includes: According to the task execution time corresponding to each subscription service task in the message queue, the current to-be-processed task is read from the message queue.

8. The method according to claim 7, characterized in that After processing the current task to be processed by the current thread, the method further includes: In the case where the current pending task fails to be executed, obtaining the current time; Determine a new execution time according to the current time, the offset time, and the randomly generated time; Updating the task execution time of the current pending task to the new execution time to obtain an updated subscription service task; The updated subscription service task is published to the message queue.

9. A task processing device, characterized in that: include: Task acquisition module, used to obtain the current pending tasks; A verification module, configured to perform a uniqueness verification on a current thread assigned to process the current task to be processed based on the task details information carried by the current task to be processed, so as to verify whether the current thread is the only thread to process the current task to be processed; The task execution module is used to process the current task to be processed through the current thread when the current thread passes the uniqueness check.

10. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the task processing method described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the task processing method described in any one of claims 1 to 8.