Content operation method, device, server and storage medium

By introducing server queues and robot candidate sets into social software, the problem of high-quality content occupying the mainstream is solved, effective display and interaction of ordinary content is achieved, and users are encouraged to publish content.

CN114820218BActive Publication Date: 2025-04-01BIGO TECH PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210368042.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-08
Publication Date
2025-04-01
Estimated Expiration
2042-04-08

AI Technical Summary

Technical Problem

Among existing social software, high-quality and interesting content is more popular, resulting in the inability to view and interact with ordinary or unpopular content, which has dampened users' enthusiasm for publishing content.

Method used

The server stores the published content and its execution operations in the queue, generates a robot candidate set, and automatically completes the published content at a preset time point through the robot.

Benefits of technology

It realizes the automatic operation of publishing content at the preset time point, improves the efficiency and accuracy of content operations, and helps to enhance users' enthusiasm for publishing content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114820218B_ABST
    Figure CN114820218B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a content operation method, device, server and storage medium, which belongs to the field of Internet. The method includes: obtaining n candidate tasks from a target queue, the candidate tasks are used to instruct the robot to perform operations on candidate published content at a candidate time point, and n is a positive integer; determining a target task among the n candidate tasks, and the target time point indicated by the target task is no later than the current time point; determining a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, and the target robot candidate set includes robots for performing operations on target published content; performing operations on target published content by the target robot. In the embodiment of the present application, it is possible to automatically complete operations on published content at a preset time point, which helps to improve the efficiency and accuracy of content operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of Internet, and in particular to a content operation method, device, server and storage medium. Background Art

[0002] With the rapid popularization of social software, more and more people are beginning to use social software to record and share their lives.

[0003] Since the level of interest and shooting quality of the published content vary, and high-quality and interesting content is more popular with the public, ordinary or unpopular content does not get viewed or interacted with, which dampens users' enthusiasm for publishing content.

[0004] In order to increase users’ desire to publish more content, it is particularly important to manipulate the content appropriately. Summary of the invention

[0005] The embodiment of the present application provides a content operation method, device, server and storage medium. The technical solution is as follows:

[0006] On the one hand, an embodiment of the present application provides a content operation method, the method comprising:

[0007] Obtain n candidate tasks from the target queue, where the candidate tasks are used to instruct the robot to perform operations on candidate published content at a candidate time point, where n is a positive integer;

[0008] Determine a target task among the n candidate tasks, wherein the target time point indicated by the target task is no later than the current time point;

[0009] Determine a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, wherein the target robot candidate set includes robots for performing operations on the target published content;

[0010] An operation is performed on the target published content through the target robot.

[0011] On the other hand, an embodiment of the present application provides a content operation device, the device comprising:

[0012] An acquisition module, used to acquire n candidate tasks from the target queue, wherein the candidate tasks are used to instruct the robot to perform operations on candidate published content at a candidate time point, where n is a positive integer;

[0013] A first determination module is used to determine a target task among the n candidate tasks, wherein a target time point indicated by the target task is not later than a current time point;

[0014] A second determination module is used to determine a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, wherein the target robot candidate set includes robots used to perform operations on the target published content;

[0015] An operation execution module is used to execute an operation on the target published content through the target robot.

[0016] On the other hand, an embodiment of the present application provides a server, comprising a processor and a memory; the memory stores at least one program, and the at least one program is used to be loaded and executed by the processor to implement the content operation method described in the above aspect.

[0017] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the content operation method described in the above aspect.

[0018] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the content operation method provided by the above aspect.

[0019] In an embodiment of the present application, a content operation mechanism is provided for performing operations on published content by a robot. After a user publishes content, the server stores the published content and the time point at which the operation is performed in a queue, and generates a robot candidate set for the published content. After the server obtains the candidate tasks from the queue, it determines the target task from the candidate tasks, and determines the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and then performs operations on the target published content by the target robot. By adopting the scheme provided in the embodiment of the present application, it is possible to automatically complete operations on published content at a preset time point, which helps to improve the efficiency and accuracy of content operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a schematic diagram of a system architecture provided by an exemplary embodiment of the present application;

[0021] Figure 2 is a flow chart of a content operation method provided by an exemplary embodiment of the present application;

[0022] Figure 3 A schematic diagram showing a content operation method provided by an exemplary embodiment of the present application is shown;

[0023] Figure 4 A flowchart showing a content operation method provided by another exemplary embodiment of the present application is shown;

[0024] Figure 5 Another exemplary embodiment of the present application provides a candidate task arrangement using a time gradient;

[0025] Figure 6 A schematic diagram showing a content processing method using a time gradient provided by another exemplary embodiment of the present application is shown;

[0026] Figure 7 A flowchart of a method for updating a robot candidate set provided by an exemplary embodiment of the present application is shown;

[0027] Figure 8 is a schematic diagram of a method for updating a robot candidate set provided by an exemplary embodiment of the present application;

[0028] Fig. 9 A complete flow chart of a content operation provided by an exemplary embodiment of the present application is shown;

[0029] Fig.10 A structural block diagram of a content operation device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0031] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0032] With the rapid popularization of social software, more and more people have begun to use it to record and share their lives. A large amount of content is produced every day, but the quality of this content varies greatly. The public prefers high-quality and interesting content, which leads to ordinary content not being viewed and interacted with, which greatly dampens users' enthusiasm for publishing content.

[0033] In view of this, in an embodiment of the present application, after the server obtains the candidate tasks from the queue, it determines the target task from the candidate tasks, and determines the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and then performs operations on the target published content through the target robot; by adopting the scheme provided in the embodiment of the present application, it is possible to automatically complete the operation of the published content at a preset time point, which helps to improve the efficiency of content operations. Figure 1 A schematic diagram of a system architecture provided by an exemplary embodiment of the present application is shown.

[0034] The system architecture may include: a terminal device 110 and a server 120 , wherein the terminal device 110 is installed with social software capable of publishing content.

[0035] There are usually multiple terminal devices 110, and each server 120 can interact with multiple terminal devices 110. The terminal device 110 is used to publish content and operate the published content, and the operation can be editing, deleting, liking and forwarding.

[0036] The server 120 is a background server of the social software, and is mainly used to publish the content uploaded by the terminal device, recommend the content, etc. For example, publish the video to the video sharing platform.

[0037] In the embodiment of the present application, the server 120 is also used to associate and store the published content and the time point at which the operation is performed. After the terminal device 110 publishes the content, the server 120 stores the published content and the corresponding time point in the queue, and generates a corresponding robot candidate set for the published content. The server 120 obtains the candidate tasks from the queue, determines the target task from the candidate tasks, and determines the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and then performs the operation on the target published content through the target robot.

[0038] Please refer to Figure 2 , which shows a flowchart of a content operation method provided by an exemplary embodiment of the present application, the method may include the following steps:

[0039] Step 201, obtain n candidate tasks from the target queue, the candidate tasks are used to instruct the robot to perform operations on candidate published content at a candidate time point, and n is a positive integer.

[0040] In a possible implementation, the content format of the published content may be video, article, picture, music, dynamic, etc. The embodiment of the present application does not limit the specific content format.

[0041] The server operates the published content through a robot, which refers to some virtual users with real user information.

[0042] In order to be able to perform operations on published content in an orderly manner, in a possible implementation, the server stores the published content and its corresponding operation time points in a queue. A piece of published content and its corresponding time point is a candidate task. When an operation needs to be performed, the server obtains n candidate tasks from the target queue, where n is a positive integer.

[0043] The candidate task is used to instruct the robot to perform operations on the candidate published content at the candidate time point, and the robot refers to some virtual users with real user information.

[0044] Step 202: determine a target task among the n candidate tasks, wherein the target time point indicated by the target task is not later than the current time point.

[0045] The server predefines the time point for executing each task, such as the 1st minute, 2nd minute, 3rd minute, 5th minute, 10th minute, etc. after publishing the content. The server only executes the task that reaches the time point for executing the operation. Not all of the n candidate tasks obtained by the server from the target queue need to be executed. In one possible implementation, it is necessary to screen these n candidate tasks, and select the candidate tasks whose time points are earlier than or equal to the current time point and determine them as the target tasks that need to be executed.

[0046] Step 203: determine a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, wherein the target robot candidate set includes robots for performing operations on the target published content.

[0047] The server generates a total set of robot candidates in advance, and obtains robots that perform operations on the published content from the total set to generate a robot candidate set. To avoid large-scale overlap between different robot candidate sets, the server generates the robot candidate set by random acquisition.

[0048] Among them, different robot candidate sets can be completely different or partially overlapped, and the robots in the robot candidate sets can perform different operations. For example, some robots perform viewing operations, and some robots perform like operations, etc.

[0049] Optionally, the server may adopt a method of pre-generating a robot candidate set, or may adopt a method of real-time generation, that is, randomly generating a robot candidate set when the time point of the task execution operation is reached.

[0050] After determining the target task from the candidate tasks, the server determines a target robot from a target robot candidate set corresponding to the target published content in response to the target published content indicated by the target task, wherein the target robot candidate set includes robots for performing operations on the target published content.

[0051] Optionally, the server may determine the target robot from the target robot candidate set corresponding to the target published content in a random or sequential manner, which is not limited in this embodiment.

[0052] Optionally, the robots in the robot candidate set can be robots that are fixed to perform a certain operation, for example, a like robot can only perform the like operation, and a comment robot can only perform the comment operation. When generating the robot candidate set from the total robot candidate set, different robots are assigned to form the robot candidate set based on the published content. For example, a published content requires 100 robots to view and 20 robots to comment, then 100 viewing robots and 20 commenting robots are randomly obtained from the total robot candidate set to form the robot candidate set. If the operation required for the target published content at the current operation time point is a viewing operation, the server determines a viewing robot from the robot candidate set.

[0053] Optionally, the robots in the robot candidate set can also be robots that can perform any operation. For example, any robot can perform both the like operation and the comment operation. When generating the robot candidate set from the total robot candidate set, the robots can be assigned to form the robot candidate set based on the published content. For example, if a published content requires 100 robots to view and 20 robots to comment, then 120 robots are randomly obtained from the total robot candidate set to form the robot candidate set. If the operation required for the target published content at the current operation time point is viewing, the server can determine any robot from the robot candidate set.

[0054] Step 204: Perform operations on the target published content through the target robot.

[0055] In a possible implementation, after determining a target robot from a corresponding target robot candidate set based on the target published content, an operation is performed on the target published content by the target robot.

[0056] Optionally, the operation may be a viewing operation, a liking operation, a sharing operation, a favorite operation, a comment operation, a forwarding operation, etc., which is not limited in this embodiment.

[0057] Indicative, such as Figure 3As shown, there are m candidate tasks in the target queue, and the server obtains n candidate tasks from them, and determines the target task based on the time points of these n candidate tasks, where m and n are both positive integers and m is greater than or equal to n. The server determines the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and the target robot operates on the published content. If the server determines that the candidate task corresponding to content 1 is the target task from the n candidate tasks, the server determines a robot from the robot candidate set corresponding to content 1 as the target robot to perform operations on content 1. If there are robots 1, 2, 3, etc. in the robot candidate set corresponding to content 1, and when content 1 needs to perform operations at the time point of performing operations, the server will determine a robot from robots 1, 2, 3, etc. as the target robot to perform operations on content 1.

[0058] To summarize, in the embodiment of the present application, after the server obtains n candidate tasks from the target queue, it determines the target task among the n candidate tasks, and then determines the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and performs operations on the target published content through the target robot; adopting the scheme provided in the embodiment of the present application, it is possible to automatically complete the operation of the published content at a preset time point, which helps to improve the efficiency and accuracy of content operations.

[0059] In order to more simply and efficiently store and obtain published content, the time point when the published content is operated, and the robot candidate set corresponding to the published content, in a possible implementation, the published content and the corresponding robot candidate set are stored in the redis cache in a key-value format, wherein the key is the content identifier of the published content, and the value is the robot identifier of each robot in the robot candidate set; the tasks are stored in the zset queue in a score-member format, wherein the score is the time point when the robot performs the operation on the published content, and the member is the content identifier of the published content.

[0060] In a possible implementation, the user may send a content publishing instruction or a content deleting instruction to the server by adding published content or deleting published content on the terminal. The following schematically illustrates the two situations.

[0061] 1. Increase the published content

[0062] In one possible implementation, when a user publishes content through a terminal, the server determines the published content as the first published content. The server generates a first robot candidate set for the first published content in response to a content publishing instruction corresponding to the first published content. The specific implementation method of generating the first robot candidate set can refer to step 203, and this embodiment will not be repeated here. The first robot candidate set includes robots for performing operations on the first published content. The server generates a first task corresponding to the first published content based on the first published content and the time gradient information corresponding to the first published content. The server adds the first task to the queue based on the load balancing strategy.

[0063] Optionally, the time gradient information refers to information obtained by the server arranging N operation time points of the first sent content and the execution operations at the corresponding time points in ascending order of time points.

[0064] Optionally, the first task consists of the first published content and its corresponding time point.

[0065] Optionally, load balancing strategies are mainly divided into two categories: static and dynamic. Static load balancing allocates tasks with a fixed probability without considering the status information of the server, such as round-robin balancing, weighted round-robin balancing, etc. Dynamic load balancing determines the allocation of tasks based on the real-time load status information of the server, such as least connection balancing, weighted least connection balancing, etc. The embodiments of this application do not limit the specific load balancing strategy.

[0066] 2. Delete published content

[0067] In another possible implementation, when the user deletes the published content through the terminal, the server determines the published content as the second published content. In response to the content deletion instruction corresponding to the second published content, the server deletes the correspondence between the second published content and the second robot candidate set, and deletes the second task corresponding to the second published content from the queue.

[0068] Optionally, the second task consists of the second published content and its corresponding time point.

[0069] Optionally, the server deletes the correspondence between the second published content and the second robot candidate set, which may be by deleting the second robot candidate set or clearing the robots in the second robot candidate set. When the second robot candidate set does not exist or the second robot candidate set is empty, the server deletes the second task corresponding to the second published content from the queue.

[0070] Since the amount of content published on social software is very large, in the embodiment of the present application, the candidate tasks in the target queue are arranged in the order of time points so that the robot can operate on the published content more accurately and timely. Figure 3 , which shows a flowchart of a content operation method provided by another exemplary embodiment of the present application, the method may include the following steps:

[0071] Step 401, obtaining the first n candidate tasks in the target queue.

[0072] In a possible implementation, the server stores the candidate tasks in the target queue in the zset queue. In the embodiment of the present application, score is the time point when the robot performs the operation on the published content, and member is the content identifier of the published content. After the server stores the candidate tasks in zest, zest sorts the members according to the score, that is, zest sorts the content identifier of the published content according to the time point when the robot performs the operation on the published content. After sorting, the candidate tasks in the target queue are arranged in chronological order of the time points, and the server obtains the first n candidate tasks in the target queue, where n is a positive integer.

[0073] Indicative, such as Figure 5 As shown, the zset queue previously stored four candidate tasks. If a number of candidate tasks are written into the queue at this time, the zset queue will re-sort the queue according to the time points of the candidate tasks. The sorted candidate tasks are stored in the zset queue in the order of time points.

[0074] Step 402 , based on the arrangement order of the n candidate tasks, the candidate time points indicated by the candidate tasks are compared with the current time point in order to obtain the target task.

[0075] In one possible implementation, after the server obtains the first n candidate tasks in the target queue, it compares the candidate time points and the current time points of the candidate tasks according to the arrangement order of the candidate tasks, obtains the candidate tasks whose candidate time points are earlier than or equal to the current time point and uses them as the target tasks.

[0076] Optionally, since the n candidate tasks are arranged in chronological order according to time points, if the ith candidate task is later than the current time point, then all candidate tasks after the ith one are later than the current time point, and subsequent candidate tasks will no longer be compared.

[0077] Step 403 , when there is no target task, determine the sleep duration based on the candidate time point indicated by the first candidate task among the n candidate tasks and the current time point.

[0078] In one possible implementation, the server obtains the first n candidate tasks in the target queue and compares the candidate time points and the current time points of the candidate tasks according to the arrangement order of the candidate tasks, and determines that all the n candidate tasks are later than the current time point, that is, there is no target task.

[0079] Optionally, since the n candidate tasks are arranged in chronological order according to time points, the first candidate task is the earliest candidate task among the n candidate tasks. If the first candidate task is later than the current time point, then all the n candidate tasks are later than the current time point and no comparison is required.

[0080] To improve processing efficiency and reduce CPU consumption, in this embodiment, the server determines the sleep duration based on the candidate time point indicated by the first candidate task among the n candidate tasks and the current time point.

[0081] For example, Figure 6 As shown, there are m candidate tasks in the target queue, and the time points of these m candidate tasks are arranged in chronological order. The server obtains the first n candidate tasks in the target queue, where n and m are both positive integers and m is greater than or equal to n. Then, based on the arrangement order of the n candidate tasks, the candidate time points indicated by the candidate tasks are compared with the current time point in sequence. If the current time point is 11:59:00, the time point of the first candidate task among the n candidate tasks is later than the current time point, and there is no target task. Based on the current time point 11:59:00 and the time point 12:00:00 indicated by the candidate task, the sleep duration t is calculated, and t is 00:01:00.

[0082] Step 404: during the sleep time, stop acquiring candidate tasks from the target queue.

[0083] During the sleep time, the server controls the process that operates the published content through the robot to sleep and stops obtaining candidate tasks from the target queue.

[0084] Step 405: When the sleep time is reached, continue to obtain candidate tasks from the target queue.

[0085] After the sleep time is reached, the server controls the process of operating the published content through the robot to resume the running state. Since the server determines the sleep time based on the candidate time point indicated by the first candidate task and the current time point, after the process of operating the published content through the robot resumes the running state, it continues to obtain candidate tasks from the target queue. At this time, at least one of the candidate tasks is earlier than or equal to the current time point and can be executed.

[0086] Step 406: If there is a target task, determine the target robot from the target robot candidate set corresponding to the target published content indicated by the target task.

[0087] In one possible implementation, the server obtains the first n candidate tasks in the target queue and compares the candidate time points and the current time points of the candidate tasks according to the arrangement order of the candidate tasks, and obtains i candidate tasks that are later than the current time point, that is, the i-th and previous candidate tasks are earlier than or equal to the current time point, and the candidate tasks after the i-th are later than the current time point, and the first i candidate tasks are taken as the target tasks, and the target robot is determined from the target robot candidate set corresponding to the target release content indicated by the target task.

[0088] For example, Figure 6 As shown, if the current time point is 12:00:11, the time points of the candidate tasks corresponding to content 4 and the candidate tasks before it are earlier than or equal to the current time point, and the time points of the candidate tasks after the candidate tasks corresponding to content 4 are later than the current time point. The candidate tasks corresponding to content 4 and the candidate tasks before it are taken as target tasks, and then the target robot is determined from the target robot candidate set corresponding to the target release content indicated by the target task.

[0089] Step 407: Perform operations on the target published content through the target robot.

[0090] The implementation of this step may refer to step 204, and this embodiment will not be described in detail here.

[0091] In this embodiment, the target tasks are sorted in the order of the time points to be operated, and the minimum time point is compared with the current time point. If a target task exists, the published content is operated. If no target task exists, the sleep time is calculated, and the operation is performed after the sleep time ends. While accurately completing the operation, useless read and write operations are reduced, the sleep strategy is implemented, the processing efficiency is greatly improved, and the CPU consumption is reduced.

[0092] In order to avoid the situation where duplicate robots perform operations on the target published content, this embodiment updates the candidate set by removing robots that have already performed operations from the target robot candidate set. Please refer to Figure 7 , which shows a flowchart of a robot candidate set updating process provided by an exemplary embodiment of the present application. The method may include the following steps.

[0093] Step 701: remove the target robot from the target robot candidate set.

[0094] In a possible implementation, the published content and the corresponding robot candidate set are stored in a redis cache in a key-value format, wherein the key is the content identifier of the published content, and the value is the robot identifier of each robot in the robot candidate set. After the target robot performs an operation on the target published content, the server updates the target robot candidate set by removing the target robot from the target robot candidate set, that is, updates the robot identifier value corresponding to the content identifier key, and the server writes the value corresponding to the updated robot candidate set back to the redis cache.

[0095] Indicatively, Figure 8 As shown, after the robot performs an operation on the content, the robot candidate set is updated by removing the robot from the robot candidate set corresponding to the content, and the updated robot candidate set is written back to the redis cache.

[0096] Step 702: When the target robot candidate set is empty, remove the target task from the target queue.

[0097] In a possible implementation, if after the target robot candidate set is updated, there is no unoperated robot in the target robot candidate set, that is, the target robot candidate set is empty, it indicates that all time points of the target release content indicated by the target task have been completed, and this target task no longer requires robot operation, and this target task is removed from the target queue.

[0098] Indicatively, Figure 8 As shown, after robot 4 performs an operation on content 4, the server updates the robot candidate set by removing robot 4 from the robot candidate set corresponding to content 2. After the robot candidate set corresponding to content 2 is updated, since there is no unoperated robot in the robot candidate set, the robot candidate set is empty, indicating that the operation of content 2 has been completed at all time points, the target task corresponding to content 2 no longer requires robot operation, and the target task corresponding to this content 2 is removed from the target queue.

[0099] Step 703: When the target robot candidate set is not empty, the target time point indicated by the target task is updated based on the time gradient information corresponding to the target published content.

[0100] In another possible implementation, if after the target robot candidate set is updated, there are unoperated robots in the target robot candidate set, that is, the target robot candidate set is not empty, it indicates that there is still an uncompleted operation at a time point in the target release content indicated by the target task, and based on the time gradient information corresponding to the target release content, the next time point that requires operation closest to the current time point is calculated and updated as the target time point in the target task.

[0101] Indicative, such as Figure 8 As shown, after robot 1 performs an operation on content 1, the robot candidate set is updated by removing robot 1 from the robot candidate set corresponding to content 1. After the robot candidate set corresponding to content 1 is updated, since there are robots in the robot candidate set that have not been operated, that is, the robot candidate set is not empty, it indicates that there are still time points for content 1 that have not completed operations. Based on the time gradient information corresponding to content 1, the next time point that needs to be operated, which is closest to the current time point, is calculated to be 12:00:07, and the time point 12:00:07 is updated to the target task.

[0102] Step 704, write the updated target task back to the target queue.

[0103] After the target time point in the target task is updated, the server writes the updated target task back to the target queue. That is, after the score is updated, the server writes the member and its corresponding score back to the zset queue.

[0104] In this embodiment, the candidate set is updated by removing robots that have been operated from the target robot candidate set to avoid repeated processing operations on the same target content by the same robot, thereby giving users a better experience as much as possible. At the same time, when the target robot candidate set is empty, the target task is removed from the target queue to avoid the server from reading and writing invalid target tasks, causing errors in server operation.

[0105] In order to ensure that different queues can trigger robot operations at the same time, in a possible implementation, the queue processing thread seizes the distributed lock to operate the content published in the queue.

[0106] To ensure that each queue processing thread only processes one queue and one queue can only be processed by one queue processing thread at a time, in a possible implementation, by using a distributed lock, each queue corresponds to a distributed lock. After the queue processing thread seizes the distributed lock of the target queue, it becomes the target queue processing thread, and the target queue processing process obtains n candidate tasks from the target queue.

[0107] Optionally, to ensure disaster tolerance, that is, if the target queue processing process is abnormal and cannot work normally, more queue processing processes than the number of queues are allocated in the embodiment of the present application, but only the queue processing process that seizes the distributed lock corresponding to the queue can process the queue normally.

[0108] Optionally, the distributed lock has the following features:

[0109] 1. In a distributed lock environment, a queue can only be executed by one thread at a time;

[0110] 2. Highly available acquisition and release of locks;

[0111] 3. High-performance lock acquisition and lock release;

[0112] 4. It has the feature of reentrancy;

[0113] 5. It has a lock failure mechanism to prevent deadlock, that is, the lock failure time is set, and the lock is released after the lock failure time is reached;

[0114] 6. It has the feature of non-blocking lock, that is, if the lock is not acquired, it will directly return the failure of acquiring the lock.

[0115] Among them, there are three ways to implement distributed locks, namely, implementing distributed locks based on a database, implementing distributed locks based on a cache (Redis, etc.), and implementing distributed locks based on Zookeeper (a distributed, open source distributed application coordination service, a distributed service framework), which is not limited in this embodiment.

[0116] In a possible implementation, when the target queue processing thread seizes the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation every second time period.

[0117] Optionally, since a lock expiration time is set in the distributed lock, the distributed lock will be released after the time is reached. Therefore, the server pre-sets a second time period, and the second time period is less than or equal to the lock expiration time period. After the queue processing process seizes the distributed lock corresponding to the queue, a lock renewal operation needs to be performed every second time period to prevent the distributed lock from being released.

[0118] For example, the lock expiration time is 30s, and the server pre-sets a second time, which is less than or equal to the lock expiration time. The second time can be 25s. To prevent the distributed lock from being released due to reaching the lock expiration time, the target queue processing thread performs a lock renewal operation every second time, i.e., 25s, so that the target queue processing thread continues to occupy the target distributed lock corresponding to the target queue and continues to process the target queue.

[0119] In another possible implementation, when an exception occurs in the target queue processing thread, the target distributed lock is released.

[0120] When the target queue processing process is abnormal and cannot work normally, the target queue processing thread can no longer occupy the target distributed lock corresponding to the target queue, and the target distributed lock is released and continued to be preempted by the remaining queue processing threads.

[0121] In one possible implementation, when the target queue processing thread seizes the target distributed lock corresponding to the target queue, n candidate tasks are obtained from the target queue through the target queue processing thread. However, since more queue processing processes than the number of queues are allocated in the embodiment of the present application, only the queue processing process that seizes the distributed lock corresponding to the queue can process the queue normally, and the queue processing process that does not seize the distributed lock corresponding to the queue cannot process the queue. Therefore, in another possible implementation, when the target queue processing thread does not seize the distributed lock, the target queue processing thread is controlled to enter a dormant state, and the duration of the dormant state is a first duration. When the first duration is reached, the target queue processing thread is awakened, wherein the awakened target queue processing thread continues to seize the distributed lock.

[0122] Optionally, the queue processing thread that has not seized the distributed lock will enter a dormant state and remain in the dormant state for a certain period of time, which can be set to 15s, 20s, 30s, etc. This period of time is the dormant period.

[0123] In this embodiment, more queue processing processes than the number of queues are allocated, and distributed locks are used to ensure that each queue can be processed. At the same time, after an exception occurs in the queue processing process, the distributed lock will be released, and the remaining queue processing processes will preempt the distributed lock and continue to process the queue. At the same time, by setting the sleep time, the queue processing threads that have not preempted the distributed lock are prevented from performing useless preemption operations. While making the server run efficiently and reliably, the disaster tolerance during the operation is guaranteed and the CPU consumption is reduced.

[0124] In combination with the above embodiments, Fig. 9 Provides a complete process of content operation:

[0125] Step 901, in response to a content deletion operation, delete the correspondence between the published content and the robot candidate set.

[0126] Step 902: In response to the content publishing operation, a candidate set of content publishing robots is generated and published.

[0127] Step 903: Generate a target task based on the published content and its corresponding time gradient information.

[0128] Step 904: Add the target task to the target queue based on the load balancing strategy.

[0129] Step 905: The queue processing thread seizes the distributed lock of the target queue. If the lock is not acquired, the thread enters a dormant state for a first duration.

[0130] Step 906: After the first duration is reached, the queue processing thread is awakened, and the queue processing thread continues to seize the distributed lock after being awakened.

[0131] Step 907: The queue processing thread seizes the distributed lock of the target queue. If the lock has been acquired, a lock renewal operation is performed every second time period.

[0132] Step 908: Obtain the first n candidate tasks from the target queue through the target queue processing thread.

[0133] Step 909 , based on the arrangement order of the n candidate tasks, sequentially compare the candidate time points indicated by the candidate tasks with the current time point to obtain the target task.

[0134] Step 910 , when there is no target task, determine the sleep duration based on the candidate time point indicated by the first candidate task among the n candidate tasks and the current time point.

[0135] Step 911, during the sleep time, stop acquiring candidate tasks from the target queue.

[0136] Step 912: When the sleep time is reached, continue to obtain candidate tasks from the target queue.

[0137] Step 913: If there is a target task, determine the target robot from the target robot candidate set corresponding to the target published content indicated by the target task.

[0138] Step 914: Perform operations on the target published content through the target robot.

[0139] Step 915, after the operation, the target robot candidate set is updated by removing the target robot from the target robot candidate set.

[0140] Step 916, when the target robot candidate set is not empty, update the target time point and write the updated target task back to the target queue.

[0141] Step 917: When the target robot candidate set is empty, remove the target task from the target queue.

[0142] Please refer to Fig.10 , which shows a structural block diagram of a content operation device provided by an embodiment of the present application. The device can be implemented as all or part of a server through software, hardware or a combination of both.

[0143] The device includes:

[0144] The acquisition module 1001 is used to acquire n candidate tasks from the target queue, where the candidate tasks are used to instruct the robot to perform operations on candidate published content at a candidate time point, where n is a positive integer;

[0145] A first determining module 1002 is used to determine a target task among the n candidate tasks, wherein the target time point indicated by the target task is not later than the current time point;

[0146] A second determination module 1003 is used to determine a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, wherein the target robot candidate set includes robots for performing operations on the target published content;

[0147] The operation module 1004 is used to perform an operation on the target published content through the target robot.

[0148] Optionally, the candidate tasks in the target queue are arranged in order of time points;

[0149] The acquisition module 1001 is used to:

[0150] Obtain the first n candidate tasks in the target queue;

[0151] The first determining module 1002 is used to:

[0152] Based on the arrangement order of the n candidate tasks, the candidate time points indicated by the candidate tasks are compared with the current time point in order to obtain the target task.

[0153] Optionally, the device further comprises:

[0154] A first sleep module, configured to determine a sleep duration based on a candidate time point indicated by a first candidate task among the n candidate tasks and a current time point when the target task does not exist;

[0155] The acquisition module 1001 is used to:

[0156] During the sleep time, stop acquiring the candidate task from the target queue;

[0157] When the sleep time is reached, the candidate task continues to be obtained from the target queue.

[0158] Optionally, the device further comprises:

[0159] A robot removal module, used to remove the target robot from the target robot candidate set;

[0160] The task removal module is used to remove the target task from the target queue when the target robot candidate set is empty.

[0161] Optionally, the device further comprises:

[0162] A task updating module, configured to update the target time point indicated by the target task based on the time gradient information corresponding to the target published content when the target robot candidate set is not empty, wherein the time gradient information includes the time point at which the operation is performed on the target published content, and the updated target time point is later than the target time point before the update;

[0163] The updated target task is written back to the target queue.

[0164] Optionally, the acquisition module 1001 is used to:

[0165] Obtain n candidate tasks from the target queue through a target queue processing thread, wherein the target queue processing thread has a target distributed lock corresponding to the target queue.

[0166] Optionally, the number of queue processing threads is greater than the number of queues;

[0167] The acquisition module 1001 is used for acquiring n candidate tasks from the target queue through the target queue processing thread when the target queue processing thread seizes the target distributed lock corresponding to the target queue;

[0168] The device also includes:

[0169] A second dormancy module is used to control the target queue processing thread to enter a dormant state when the target queue processing thread fails to seize the distributed lock, and the duration of the dormant state is a first duration;

[0170] A wake-up module is used to wake up the target queue processing thread when the first time duration is reached, wherein the target queue processing thread continues to seize the distributed lock after being woken up.

[0171] Optionally, when the target queue processing thread seizes the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation every second time period;

[0172] When an exception occurs in the target queue processing thread, the target distributed lock is released.

[0173] Optionally, the device further comprises:

[0174] a generating module, configured to generate a first robot candidate set for the first published content in response to a content publishing instruction corresponding to the first published content, wherein the first robot candidate set includes robots for performing operations on the first published content;

[0175] The generating module is further configured to generate a first task corresponding to the first published content based on the first published content and the time gradient information corresponding to the first published content;

[0176] An adding module is used to add the first task to the queue based on a load balancing strategy.

[0177] Optionally, the device further comprises:

[0178] a deleting module, configured to delete the corresponding relationship between the second published content and the second robot candidate set in response to a content deletion instruction corresponding to the second published content;

[0179] The deleting module is further configured to delete the second task corresponding to the second published content from the queue.

[0180] Optionally, the published content and the corresponding robot candidate set are stored in a redis cache in a key-value format, wherein the key is the content identifier of the published content and the value is the robot identifier of each robot in the robot candidate set;

[0181] Tasks are stored in the zset queue in the form of score-member, where score is the time point when the robot performs an operation on the published content, and member is the content identifier of the published content.

[0182] To summarize, in the embodiment of the present application, after the server obtains n candidate tasks from the target queue, it determines the target task among the n candidate tasks, and then determines the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and performs operations on the target published content through the target robot; adopting the scheme provided in the embodiment of the present application, it is possible to automatically complete the operation of the published content at a preset time point, which helps to improve the efficiency and accuracy of content operations.

[0183] An embodiment of the present application further provides a server, the server comprising a processor and a memory, the memory storing at least one program, the at least one program being used to be loaded and executed by the processor to implement the content operation method as described in the above embodiment.

[0184] An embodiment of the present application further provides a computer-readable storage medium, which stores at least one program, and the at least one program is used to be executed by a processor to implement the content operation method described in the above embodiment.

[0185] The embodiment of the present application provides a computer program product, which includes computer instructions, which are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the server device executes the content operation method provided in the above embodiment.

[0186] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0187] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A content operation method, characterized in that: The method comprises: Obtain n candidate tasks from a target queue, wherein the candidate tasks are used to instruct the robot to perform operations on candidate published content at candidate time points, wherein the candidate tasks include the candidate published content and candidate time points corresponding to the candidate published content, and n is a positive integer. The candidate tasks in the target queue are arranged in chronological order of time points, and different candidate tasks correspond to different candidate published content. After the robot performs operations on the candidate published content, the candidate time points corresponding to the candidate published content are updated based on time gradient information, wherein the time gradient information includes time points at which operations are performed on the candidate published content. The time gradient information is information obtained by arranging N operation time points of the first published content and the operations performed at the corresponding time points in an ascending order of time points, and the first published content is content published by a user through a terminal; Determine a target task among the n candidate tasks, wherein the target time point indicated by the target task is no later than the current time point; Determine a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, wherein the target robot candidate set includes robots for performing operations on the target published content; An operation is performed on the target published content through the target robot.

2. The method according to claim 1, characterized in that The candidate tasks in the target queue are arranged in order of time points; The step of obtaining n candidate tasks from the target queue includes: Obtain the first n candidate tasks in the target queue; The determining of the target task among the n candidate tasks includes: Based on the arrangement order of the n candidate tasks, the candidate time points indicated by the candidate tasks are compared with the current time point in order to obtain the target task.

3. The method according to claim 2, characterized in that The method further comprises: In the case where the target task does not exist, determining the sleep duration based on the candidate time point indicated by the first candidate task among the n candidate tasks and the current time point; During the sleep time, stop acquiring the candidate task from the target queue; When the sleep time is reached, the candidate task continues to be obtained from the target queue.

4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Remove the target robot from the target robot candidate set; When the target robot candidate set is empty, the target task is removed from the target queue.

5. The method according to claim 4, characterized in that After removing the target robot from the target robot candidate set, the method further includes: When the target robot candidate set is not empty, based on the time gradient information corresponding to the target published content, the target time point indicated by the target task is updated, wherein the time gradient information includes the time point at which the operation is performed on the target published content, and the updated target time point is later than the target time point before the update; The updated target task is written back to the target queue.

6. The method according to any one of claims 1 to 3, characterized in that: The step of obtaining n candidate tasks from the target queue includes: Obtain n candidate tasks from the target queue through a target queue processing thread, wherein the target queue processing thread has a target distributed lock corresponding to the target queue.

7. The method according to claim 6, characterized in that The number of queue processing threads is greater than the number of queues; The processing thread through the target queue, obtaining n candidate tasks from the target queue, includes: When the target queue processing thread seizes the target distributed lock corresponding to the target queue, the target queue processing thread obtains n candidate tasks from the target queue; The method further comprises: When the target queue processing thread fails to seize the distributed lock, the target queue processing thread is controlled to enter a dormant state, and the duration of the dormant state is a first duration; When the first duration is reached, the target queue processing thread is awakened, wherein the awakened target queue processing thread continues to seize the distributed lock.

8. The method according to claim 7, characterized in that When the target queue processing thread seizes the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation every second time period; When an exception occurs in the target queue processing thread, the target distributed lock is released.

9. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In response to a content publishing instruction corresponding to the first published content, generating a first robot candidate set for the first published content, the first robot candidate set including robots for performing operations on the first published content; generating a first task corresponding to the first published content based on the first published content and time gradient information corresponding to the first published content; The first task is added to the queue based on a load balancing strategy.

10. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: In response to a content deletion instruction corresponding to the second published content, deleting a correspondence between the second published content and the second robot candidate set; The second task corresponding to the second published content is deleted from the queue.

11. The method according to any one of claims 1 to 3, characterized in that: The published content and the corresponding robot candidate set are stored in the redis cache in a key-value format, where the key is the content identifier of the published content and the value is the robot identifier of each robot in the robot candidate set; Tasks are stored in the zset queue in the form of score-member, where score is the time point when the robot performs an operation on the published content, and member is the content identifier of the published content.

12. A content operation device, characterized in that: The device comprises: an acquisition module, for acquiring n candidate tasks from a target queue, wherein the candidate tasks are used to instruct the robot to perform operations on candidate published content at candidate time points, wherein the candidate tasks include the candidate published content and candidate time points corresponding to the candidate published content, and n is a positive integer. The candidate tasks in the target queue are arranged in chronological order of time points, and different candidate tasks correspond to different candidate published content. After the robot performs operations on the candidate published content, the candidate time points corresponding to the candidate published content are updated based on time gradient information, wherein the time gradient information includes time points at which operations are performed on the candidate published content. The time gradient information is information obtained by arranging N operation time points of the first published content and the operations performed at the corresponding time points in an ascending order of time points, and the first published content is content published by a user through a terminal; A first determination module is used to determine a target task among the n candidate tasks, wherein a target time point indicated by the target task is not later than a current time point; A second determination module is used to determine a target robot from a target robot candidate set corresponding to the target published content indicated by the target task, wherein the target robot candidate set includes robots used to perform operations on the target published content; An operation execution module is used to execute an operation on the target published content through the target robot.

13. A server, characterized in that: The server includes a processor and a memory; the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the content operation method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one program, and the at least one program is used to be executed by a processor to implement the content operation method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device implements the content operation method as described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Comment information publishing method and device, equipment and computer readable storage medium

    CN111783013A

  • Distributed lock calling method and device, electronic equipment and storage medium

    CN112799791A