WO2023193653A1 - Content operation method and apparatus, and server and storage medium - Google Patents

Content operation method and apparatus, and server and storage medium Download PDF

Info

Publication number
WO2023193653A1
WO2023193653A1 PCT/CN2023/085155 CN2023085155W WO2023193653A1 WO 2023193653 A1 WO2023193653 A1 WO 2023193653A1 CN 2023085155 W CN2023085155 W CN 2023085155W WO 2023193653 A1 WO2023193653 A1 WO 2023193653A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
robot
candidate
content
queue
Prior art date
Application number
PCT/CN2023/085155
Other languages
French (fr)
Chinese (zh)
Inventor
汪强
郑海源
Original Assignee
百果园技术(新加坡)有限公司
汪强
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 百果园技术(新加坡)有限公司, 汪强 filed Critical 百果园技术(新加坡)有限公司
Publication of WO2023193653A1 publication Critical patent/WO2023193653A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/01Social networking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Definitions

  • Embodiments of the present application relate to the field of the Internet, and in particular to a content operation method, device, server and storage medium.
  • Embodiments of the present application provide a content operation method, device, server and storage medium.
  • the technical solutions are as follows:
  • embodiments of the present application provide a content operation method, which method includes:
  • n candidate tasks from the target queue the candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, n is a positive integer;
  • the target robot candidate set includes robots used to perform operations on the target published content
  • the target posted content is acted upon by the target bot.
  • a content operation device which includes:
  • the acquisition module is configured to acquire n candidate tasks from the target queue.
  • the candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, and n is a positive integer;
  • the first determination module is configured to determine 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;
  • the second determination module is configured to determine the target robot from the 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 the target published content;
  • An execution operation module is configured to perform an operation on the target published content through the target robot.
  • embodiments of the present application provide a server, which includes a processor and a memory.
  • a memory at least one program is stored in the memory, and the at least one program is loaded and executed by the processor to implement the content operation method as described in the above aspect.
  • embodiments of the present application provide a computer-readable storage medium that stores at least one instruction, and the at least one instruction is executed by a processor to implement content operations as described above. method.
  • inventions of the present application provide a computer program product.
  • the computer program product includes computer instructions, and the computer instructions 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 computer device executes the content operation method provided by the above aspect.
  • Figure 1 is a schematic diagram of the system architecture provided by an exemplary embodiment of the present application.
  • Figure 2 is a flow chart of a content operation method provided by an exemplary embodiment of the present application.
  • Figure 3 shows a schematic diagram of a content operation method provided by an exemplary embodiment of the present application
  • Figure 4 shows a flow chart of a content operation method provided by another exemplary embodiment of the present application.
  • Figure 5 shows a candidate task arrangement using temporal gradients provided by another exemplary embodiment of the present application.
  • Figure 6 shows a schematic diagram of a content processing method using temporal gradient provided by another exemplary embodiment of the present application.
  • Figure 7 shows a flow chart of a method for updating a robot candidate set provided by an exemplary embodiment of the present application
  • Figure 8 is a schematic diagram of a method for updating a robot candidate set provided by an exemplary embodiment of the present application.
  • Figure 9 shows a complete flow chart of a content operation provided by an exemplary embodiment of the present application.
  • Figure 10 shows a structural block diagram of a content operating device provided by an exemplary embodiment of the present application.
  • FIG. 1 shows a schematic diagram of the system architecture provided by an exemplary embodiment of the present application.
  • the system architecture may include: a terminal device 110 and a server 120, wherein the terminal device 110 is installed with social software that can publish content.
  • the number of terminal devices 110 is usually multiple, and each server 120 can interact with multiple terminal devices 110 .
  • the terminal device 110 is used to publish content and perform operations on the published content.
  • the operations may include editing, deleting, liking, forwarding, etc.
  • the server 120 is a backend server for social software, and is mainly used to publish content uploaded by the terminal device 110, make content recommendations, and so on. For example, post a video to a video sharing platform.
  • the server 120 is also used to associate and store the published content and the time point at which the operation is performed.
  • the server 120 stores the published content and its 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 release content indicated by the target task, and then uses the target robot to perform operations on the target release content.
  • Figure 2 shows a flow chart of a content operation method provided by an exemplary embodiment of the present application.
  • the method may include the following steps:
  • Step 201 Obtain n candidate tasks from the target queue.
  • the candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time points, and n is a positive integer.
  • the content form of the published content may be videos, articles, pictures, music, dynamics, etc.
  • the embodiments of this application do not limit the specific content form.
  • the server operates the published content through robots, which refer to some virtual users with real user information.
  • the server stores the published content and its corresponding operation time point in the queue.
  • a piece of published content and its corresponding time point is a candidate task.
  • the server obtains n candidate tasks from the target queue, where n is a positive integer.
  • the candidate task is used to instruct the robot to perform operations on the candidate release content at the candidate time point.
  • the robot refers to some virtual users with real user information.
  • Step 202 Determine the 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.
  • the server pre-stipulates the time points for each task execution operation.
  • the specified time points are the 1st minute, 2nd minute, 3rd minute, 5th minute, 10th minute, etc. after the content is published.
  • the server only executes the execution time when the operation is reached.
  • the n candidate tasks need to be screened to filter out the time point.
  • Candidate tasks that are earlier than or equal to the current time point are identified as target tasks that require action.
  • Step 203 Determine the target robot from the target robot candidate set corresponding to the target published content indicated by the target task.
  • the target robot candidate set includes robots used to perform operations on the target published content.
  • the server generates a total set of robot candidates in advance.
  • the robots that perform operations on the published content are obtained from the total set to generate a robot candidate set.
  • the server uses random acquisition to generate robots. candidate set.
  • different robot candidate sets can be completely different or partially overlap.
  • the robots in the robot candidate set can perform different operations. For example, some robots perform viewing operations, and some robots perform like operations.
  • the server can generate a robot candidate set in advance or generate a robot candidate set on-the-fly. This method is to randomly generate a robot candidate set when the time point of task execution is reached.
  • the server determines the target task from the candidate tasks, in response to the target release content indicated by the target task, it determines the target robot from the target robot candidate set corresponding to the target release content.
  • the target robot candidate set includes robots used to perform operations on the target release content. .
  • the server determines 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.
  • the robots in the robot candidate set can be robots that perform a certain operation.
  • a like robot can only perform a like operation
  • a comment robot can only perform a comment operation.
  • the robot candidate set is generated from the total robot candidate set according to the release Robots with different content allocations form a robot candidate set. For example, if a content release requires 100 robots to watch and 20 robots to comment, then 100 viewing robots and 20 commenting robots are randomly obtained from the total robot candidate set to form a robot candidate set. If the current The operation required to publish the content at the operation time point is a viewing operation, and the server determines a viewing robot from the robot candidate set.
  • the robots in the robot candidate set can also be robots that perform any operation.
  • any robot can perform either a like operation or a comment operation.
  • the robot candidate set is allocated according to the published content.
  • Robots can form a robot candidate set. For example, if a published content requires 100 robots to watch and 20 robots to comment, then 120 robots are randomly obtained from the total robot candidate set to form a robot candidate set. If the target publishing content at the current operation time point needs to be If the operation is viewing, the server can determine any robot from the robot candidate set.
  • Step 204 Use the target robot to perform operations on the target published content.
  • the target robot after the target robot is determined from the corresponding target robot candidate set based on the target published content, the target robot performs operations on the target published content.
  • the operation may be a viewing operation, a like operation, a sharing operation, a collection operation, a comment operation, a forwarding operation, etc., which are not limited in this embodiment.
  • the server obtains n candidate tasks from it, 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 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 the candidate task corresponding to content 1 from n candidate tasks as the target task, Then 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 the robot candidate set corresponding to content 1 includes robots 1, 2, 3... When content 1 needs to perform an operation at the execution time point, the server will determine the robot from robots 1, 2, 3... as the target robot for the content. 1Perform the operation.
  • the server 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 from the target robot candidate set corresponding to the target release content indicated by the target task.
  • the robot performs operations on the target published content through the target robot; using the solution provided by the embodiment of the present application, the operation on the published content can be automatically completed at a preset time point, which helps to improve the efficiency and accuracy of content operations.
  • the corresponding robot candidate set is stored and obtained.
  • the published content and the corresponding robot candidate set are stored in the redis cache in the form of key-value, where key is the content identifier of the published content, and value is the robot identification of each robot in the robot candidate set;
  • the task is stored in the zset queue in the form of score-member, where score is the time point when the robot performs operations on the published content, and member is the content identification of the published content.
  • the user can send a content publishing instruction or a content deletion instruction to the server by adding published content or deleting published content on the terminal.
  • a content publishing instruction or a content deletion instruction to the server by adding published content or deleting published content on the terminal.
  • the server determines the published content as the first published content, and the server generates a first published content for the first published content in response to a content publishing instruction corresponding to the first published content.
  • Robot candidate set The method of generating the first robot candidate set can refer to step 203. This embodiment will not be repeated here.
  • the first robot candidate set includes robots used to perform operations on the first published content.
  • the server is based on the first published content. and time gradient information corresponding to the first published content, to generate a first task corresponding to the first published content, and the server adds the first task to the queue based on the load balancing policy.
  • the time gradient information refers to the information obtained by the server arranging the N operation time points of the first content and the execution operations at the corresponding time points from small to large time points.
  • the first task consists of the first release content and its corresponding time point.
  • 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 algorithm balancing, weighted round-robin algorithm balancing, etc.
  • Dynamic load balancing uses the real-time load status information of the server to determine task allocation, such as minimum connection method balancing, Weighted least connection method balancing, etc., the embodiments of this application do not limit the specific load balancing strategy.
  • the server determines the published content as the second published content, and in response to the content deletion instruction corresponding to the second published content, the server deletes the second published content
  • the second task corresponding to the second published content is deleted from the queue according to the corresponding relationship with the second robot candidate set.
  • the second task consists of the second release content and its corresponding time point.
  • the server deletes the corresponding relationship between the second published content and the second robot candidate set, which can be by deleting the second robot candidate set or clearing the robots in the second robot candidate set.
  • the second robot candidate set does not exist or the second robot candidate set does not exist.
  • the server deletes the second task corresponding to the second published content from the queue.
  • FIG. 3 shows a flow chart of a content operation method provided by another exemplary embodiment of the present application. The method may include the following steps:
  • Step 401 Obtain the first n candidate tasks in the target queue.
  • the server stores the candidate tasks in the target queue in the zset queue.
  • score is the time point when the robot performs operations on the published content
  • member is the content identifier of the published content
  • the server After the candidate tasks are stored in zest, zest sorts the members according to the score. That is, zest sorts the content identifiers of the published content according to the time point when the robot performs the operation on the published content.
  • the candidate tasks in the target queue are arranged in order of time points. Arranged in order, the server obtains the first n candidate tasks in the target queue, n is a positive integer.
  • the zset queue previously stored four candidate tasks. If a candidate task is written into the queue at this time, the zset queue will reorder the queue according to the time point of the candidate task. The sorted candidates Tasks are stored in the zset queue in order of time points.
  • Step 402 Based on the order of n candidate tasks, compare the candidate time points indicated by the candidate tasks with the current time point in order to obtain the target task.
  • the server after the server obtains the first n candidate tasks in the target queue, it compares the candidate time points of the candidate tasks and the current time point in the order of the candidate tasks, and obtains that the candidate time points are earlier than or equal to Candidate tasks at the current time point and use them as target tasks.
  • n candidate tasks are arranged in the order of time points, if the i-th candidate task is later than the current time point, then the candidate tasks after the i-th task are all later than the current time point, and subsequent tasks will no longer be considered.
  • Candidate tasks are compared.
  • Step 403 If 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.
  • the server obtains the first n candidate tasks in the target queue and compares the candidate time points of the candidate tasks with the current time point according to the order of the candidate tasks, and then determines that all n candidate tasks are Later than the current time point, that is, the target task does not exist.
  • 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 These n candidate tasks are all later than the current time point and no longer need to be compared.
  • 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.
  • n candidate tasks in the target queue there are m candidate tasks in the target queue.
  • the time points of these m candidate tasks are arranged in 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, and then based on the order of n candidate tasks, sequentially compare the candidate time points indicated by the candidate tasks with the current time point. If the current time point is 11:59:00, then among the n candidate tasks The time points of the first candidate task are all later than the current time point, and there is no target task.
  • the sleep duration t, t is calculated based on the current time point 11:59:00 and the time point 12:00:00 indicated by the candidate task. is 00:01:00.
  • Step 404 Stop obtaining candidate tasks from the target queue during the sleep period.
  • the server controls the process of operating the published content through the robot to sleep and stops obtaining candidate tasks from the target queue.
  • Step 405 When the sleep duration is reached, continue to obtain candidate tasks from the target queue.
  • the server controls the process of operating the published content through the robot to resume. Running status. Since the server is based on the candidate time point indicated by the first candidate task and the sleep duration determined at the current time point, after the process of operating the published content through the robot resumes the running status, it continues to obtain candidate tasks from the target queue. At this time, at least one candidate task among the candidate tasks is earlier than or equal to the current time point and can be executed.
  • Step 406 If a target task exists, determine the target robot from the target robot candidate set corresponding to the target release content indicated by the target task.
  • the server obtains the first n candidate tasks in the target queue and compares the candidate time points of the candidate tasks and the current time point according to the order of the candidate tasks, and obtains that the i candidate tasks are later than the current time point.
  • Time point that is, the i-th candidate task and the candidate tasks before it are all earlier than or equal to the current time point, and the candidate tasks after the i-th item are all later than the current time point.
  • 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 corresponding to content 4
  • the time points of the candidate tasks after the candidate task are all later than the current time point.
  • the candidate task corresponding to content 4 and the candidate tasks before it are regarded as the target tasks, and then the target is determined from the target robot candidate set corresponding to the target release content indicated by the target task. robot.
  • Step 407 Use the target robot to perform operations on the target published content.
  • step 204 For the implementation of this step, reference may be made to step 204, which will not be described again in this embodiment.
  • the target tasks are sorted in the order of time points to be operated, and the smallest time point is compared with the current time point. If the target task exists, the published content is operated, and if there is no target task, the published content is operated. In this case, the sleep time is calculated and the operation is performed after the sleep period is over. While the operation is completed accurately, useless read and write operations are reduced, the sleep strategy is implemented, the processing efficiency is greatly improved, and the CPU consumption is reduced.
  • the candidate set is updated by removing robots that have already operated from the target robot candidate set.
  • Figure 7 shows a The exemplary embodiment provides a flow chart of a robot candidate set updating process. The method may include the following steps.
  • Step 701 Remove the target robot from the target robot candidate set.
  • the published content and the corresponding robot candidate set are stored in the redis cache in the form of key-value, 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.
  • the server updates the target robot candidate set by removing the target robot from the target robot candidate set, that is, updating the robot identification value corresponding to the content identification key, and the server will update the robot candidate set The corresponding value is written back to the redis cache.
  • 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.
  • Step 702 When the target robot candidate set is empty, remove the target task from the target queue.
  • the target robot candidate set if after the target robot candidate set is updated, there are no unoperated robots in the target robot candidate set, that is, when 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 After the operation is completed, this target task no longer requires robot operation, and this target task is removed from the target queue.
  • the server updates the robot candidate set by removing robot 4 from the robot candidate set corresponding to content 2.
  • the robot candidate set corresponding to content 2 is updated, Since there are no unoperated robots in the robot candidate set, that is, the robot candidate set is empty, it indicates that the operations have been completed at all time points of content 2.
  • the target task corresponding to content 2 no longer requires robot operation.
  • the target task corresponding to content 2 is removed from the robot candidate set. removed from the target queue.
  • Step 703 If the target robot candidate set is not empty, update the target time point indicated by the target task based on the time gradient information corresponding to the target release content.
  • the target robot candidate set if after the target robot candidate set is updated, there are unoperated robots in the target robot candidate set, that is, when the target robot candidate set is not empty, it indicates that the target release content indicated by the target task still exists at a time point. For unfinished operations, based on the time gradient information corresponding to the target release content, calculate the next time point that requires the operation closest to the current time point, and update it to the target task as the target time point.
  • the robot candidate set is updated by removing robot 1 from the robot candidate set corresponding to content 1.
  • the robot candidate set corresponding to content 1 is updated, Since there are unoperated robots in the robot candidate set, that is, the robot candidate set is not empty, it indicates that content 1 still has unfinished operations at time points.
  • the next operation that needs to be performed closest to the current time point is calculated.
  • the time point is 12:00:07. Update the time point 12:00:07 to the target task.
  • Step 704 Write the updated target task back to the target queue.
  • the server 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.
  • the candidate set is updated by removing robots that have already been operated from the target robot candidate set, so as to avoid repeated processing operations on the same target content by the same robot, and to provide users with a better experience as much as possible.
  • the target robot candidate set is empty, removing the target task from the target queue can prevent the server from reading and writing invalid target tasks, causing errors in server operation.
  • the queue processing thread is used to seize distributed locks to operate the content published in the queue.
  • 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. The target queue processing process obtains n candidate tasks from the target queue.
  • the target queue processing process is abnormal and cannot work normally
  • more queue processing processes than the number of queues are allocated, but only those that seize the distributed lock corresponding to the queue are allocated.
  • the queue processing process can handle the queue normally.
  • distributed locks have the following features:
  • a queue can only be executed by one thread at the same time
  • distributed locks have three implementation methods, namely distributed locks based on database, distributed locks based on cache (Redis, etc.), and distributed locks based on Zookeeper (a distributed, open source distributed application coordination service, which is a Distributed service framework) implements distributed locks, which is not limited in this embodiment.
  • the target queue processing thread when the target queue processing thread preempts the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation on the pair every second time period.
  • the server presets a second time period.
  • the second time period is less than or equal to the lock expiration time, and the queue processing process preempts it. After the distributed lock corresponding to the queue is obtained, the lock renewal operation needs to be performed every second interval to prevent the distributed lock from being released.
  • the server pre-sets the second time duration.
  • the second time duration is less than or equal to the lock expiration time.
  • the second time duration can be 25s.
  • the target queue processing thread The lock renewal operation is performed every second period of time, that is, 25 seconds, 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.
  • the target distributed lock is released.
  • the target queue processing thread cannot continue to occupy the target distributed lock corresponding to the target queue.
  • the target distributed lock is released and other queue processing threads continue to preempt it.
  • n candidate tasks are obtained from the target queue through the target queue processing thread.
  • the queue processing processes that have preempted the distributed lock corresponding to the queue can process the queue normally, and there are no queue processing processes that have preempted the distributed lock corresponding to the queue. The queue cannot be processed.
  • the target queue processing thread when the target queue processing thread does not seize the distributed lock, the target queue processing thread is controlled to enter the sleep state, and the duration of the sleep state is the first duration, When the first duration is reached, the target queue processing thread is awakened, and the awakened target queue processing thread continues to seize the distributed lock.
  • the queue processing thread that has not preempted the distributed lock will enter the dormant state and remain dormant for a certain period of time.
  • This period can be set to 15s, 20s, 30s, etc., and this period is the dormancy duration.
  • more queue processing processes than the number of queues are allocated, and distributed locks are used to ensure that each queue can be processed.
  • the distributed lock will be released.
  • the remaining queue processing processes seize the distributed lock and continue to process the queue.
  • 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, it ensures that the operation process is Disaster tolerance reduces CPU consumption.
  • Figure 9 provides a complete process of content operation:
  • Step 901 In response to the content deletion operation, delete the correspondence between the published content and the robot candidate set.
  • Step 902 In response to a content publishing operation, generate and publish a content robot candidate set.
  • Step 903 Generate a target task based on the published content and its corresponding time gradient information.
  • Step 904 Add the target task to the target queue based on the load balancing policy.
  • Step 905 The queue processing thread seizes the distributed lock of the target queue. If the lock is not obtained, it enters the sleep state for the first duration.
  • Step 906 After reaching the first duration, wake up the queue processing thread, and continue to seize the distributed lock after the queue processing thread wakes up.
  • Step 907 The queue processing thread seizes the distributed lock of the target queue. If the lock has been acquired, the lock renewal operation is performed every second time.
  • Step 908 Obtain the first n candidate tasks from the target queue through the target queue processing thread.
  • Step 909 Based on the order of n candidate tasks, compare the candidate time points indicated by the candidate tasks with the current time point in order to obtain the target task.
  • Step 910 If 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.
  • Step 911 Stop obtaining candidate tasks from the target queue during the sleep period.
  • Step 912 When the sleep duration is reached, continue to obtain candidate tasks from the target queue.
  • Step 913 If there is a target task, determine the target robot from the target robot candidate set corresponding to the target release content indicated by the target task.
  • Step 914 Use the target robot to perform operations on the target published content.
  • Step 915 After the operation, update the target robot candidate set by removing the target robot from the target robot candidate set.
  • 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.
  • Step 917 If the target robot candidate set is empty, remove the target task from the target queue.
  • FIG. 10 shows a structural block diagram of a content operating device provided by an embodiment of the present application.
  • the device can be implemented as all or part of the server through software, hardware, or a combination of both.
  • the device includes:
  • the acquisition module 1001 is configured to acquire n candidate tasks from the target queue.
  • the candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, and n is a positive integer;
  • the first determination module 1002 is configured to determine 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;
  • the second determination module 1003 is configured to determine the target robot from the 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 the target published content;
  • the operation module 1004 is configured to perform operations on the target published content through the target robot.
  • the candidate tasks in the target queue are arranged in order of time points
  • the acquisition module 1001 is configured as:
  • the first determination module 1002 is configured as:
  • the candidate time points indicated by the candidate tasks and the current time point are sequentially compared to obtain the target task.
  • the device also includes:
  • the first sleep module is configured to 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 when the target task does not exist;
  • the acquisition module 1001 is configured as:
  • the device also includes:
  • a robot removal module configured to remove the target robot from the target robot candidate set
  • a task removal module configured to remove the target task from the target queue when the target robot candidate set is empty.
  • the device also includes:
  • a task update module configured to update the target time point indicated by the target task based on the time gradient information corresponding to the target release content when the target robot candidate set is not empty, and the time gradient
  • the information includes the time point at which the operation is performed on the target published content, and the target time point after the update is later than the target time point before the update;
  • the acquisition module 1001 is configured as:
  • n candidate tasks are obtained from the target queue through a target queue processing thread, which has a target distributed lock corresponding to the target queue.
  • the number of queue processing threads is greater than the number of queues
  • the acquisition module 1001 is configured to acquire n items from the target queue through the target queue processing thread when the target queue processing thread preempts the target distributed lock corresponding to the target queue.
  • the device also includes:
  • the second sleep module is configured to control the target queue processing thread to enter a sleep state when the target queue processing thread does not seize the distributed lock, and the duration of the sleep state is the first time length;
  • the wake-up module is configured to wake up the target queue processing thread when the first duration is reached, wherein the wake-up target queue processing thread continues to seize the distributed lock.
  • the target queue processing thread when the target queue processing thread preempts the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation every second time period;
  • the target distributed lock is released.
  • the device also includes:
  • a generation 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, where the first robot candidate set includes information for performing operations on the first published content. robot;
  • the generation 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;
  • Add a module configured to add the first task to the queue based on the load balancing policy.
  • the device also includes:
  • a deletion 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
  • the deletion module is also configured to delete the second task corresponding to the second published content from the queue.
  • the published content and the corresponding robot candidate set are stored in the redis cache in 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 operations on the published content, and member is the content identifier of the published content.
  • the server 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 from the target robot candidate set corresponding to the target release content indicated by the target task.
  • the robot performs operations on the target published content through the target robot; using the solution provided by the embodiment of the present application, the operation on the published content can be automatically completed at a preset time point, which helps to improve the efficiency and accuracy of content operations.
  • An embodiment of the present application also provides a server.
  • the server includes a processor and a memory. At least one program is stored in the memory. The at least one program is loaded and executed by the processor to implement the above embodiments. How to operate the content described above.
  • Embodiments of the present application also provide a computer-readable storage medium that stores at least one program, and the at least one program is executed by a processor to implement the content operation method as described in the above embodiments.
  • Embodiments of the present application provide a computer program product.
  • the computer program product includes computer instructions, and the computer instructions 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 by the above embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • General Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Health & Medical Sciences (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Manipulator (AREA)

Abstract

The embodiments of the present application belong to the field of the Internet. Disclosed are a content operation method and apparatus, and a server and a storage medium. The method comprises: acquiring n candidate tasks from a target queue, wherein a candidate task is used for instructing a robot to execute an operation on candidate release content at a candidate time point, and n is a positive integer (201); determining a target task from among the n candidate tasks, wherein a target time point that is indicated by the target task is not later than the current time point (202); determining a target robot from a target robot candidate set corresponding to target release content, which is indicated by the target task, wherein the target robot candidate set includes a robot for executing an operation on the target release content (203); and executing the operation on the target release content by means of the target robot (204). In the embodiments of the present application, an operation on release content can be automatically completed at a preset time point, which facilitates the improvement of the efficiency and accuracy of content operations.

Description

内容操作方法、装置、服务器及存储介质Content operation method, device, server and storage medium
本申请要求于2022年04月08日提交的申请号为202210368042.5、发明名称为“内容操作方法、装置、服务器及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application with application number 202210368042.5 and the invention name "Content Operation Method, Device, Server and Storage Medium" submitted on April 8, 2022, the entire content of which is incorporated into this application by reference. .
技术领域Technical field
本申请实施例涉及互联网领域,特别涉及一种内容操作方法、装置、服务器及存储介质。Embodiments of the present application relate to the field of the Internet, and in particular to a content operation method, device, server and storage medium.
背景技术Background technique
随着社交软件的快速普及,越来越多的人开始使用社交软件记录和分享生活。With the rapid popularity of social software, more and more people are beginning to use social software to record and share their lives.
由于发布内容的趣味程度、拍摄质量等各不相同,而优质有趣的内容更受大众欢迎,导致那些比较普通或冷门的内容得不到观看和交互,打击了用户发布内容的积极性。Since the interestingness and shooting quality of published content vary, and high-quality and interesting content is more popular with the public, the more common or unpopular content cannot be viewed and interacted with, which dampens the enthusiasm of users to publish content.
发明内容Contents of the invention
本申请实施例提供了一种内容操作方法、装置、服务器及存储介质。所述技术方案如下:Embodiments of the present application provide a content operation method, device, server and storage medium. The technical solutions are as follows:
一方面,本申请实施例提供了一种内容操作方法,所述方法包括:On the one hand, embodiments of the present application provide a content operation method, which method includes:
从目标队列中获取n条候选任务,所述候选任务用于指示机器人在候选时间点对候选发布内容执行操作,n为正整数;Obtain n candidate tasks from the target queue, the candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, n is a positive integer;
确定n条所述候选任务中的目标任务,所述目标任务所指示的目标时间点不晚于当前时间点;Determine the 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;
从所述目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,所述目标机器人候选集中包含用于对所述目标发布内容执行操作的机器人;Determine the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and the target robot candidate set includes robots used to perform operations on the target published content;
通过所述目标机器人对所述目标发布内容执行操作。The target posted content is acted upon by the target bot.
另一方面,本申请实施例提供了一种内容操作装置,所述装置包括:On the other hand, embodiments of the present application provide a content operation device, which includes:
获取模块,配置为从目标队列中获取n条候选任务,所述候选任务用于指示机器人在候选时间点对候选发布内容执行操作,n为正整数;The acquisition module is configured to acquire n candidate tasks from the target queue. The candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, and n is a positive integer;
第一确定模块,配置为确定n条所述候选任务中的目标任务,所述目标任务所指示的目标时间点不晚于当前时间点;The first determination module is configured to determine 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;
第二确定模块,配置为从所述目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,所述目标机器人候选集中包含用于对所述目标发布内容执行操作的机器人;The second determination module is configured to determine the target robot from the 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 the target published content;
执行操作模块,配置为通过所述目标机器人对所述目标发布内容执行操作。An execution operation module is configured to perform an operation on the target published content through the target robot.
另一方面,本申请实施例提供了一种服务器,所述服务器包括处理器和存 储器;所述存储器中存储有至少一段程序,所述至少一段程序被所述处理器加载并执行以实现如上述方面所述的内容操作方法。On the other hand, embodiments of the present application provide a server, which includes a processor and a memory. A memory; at least one program is stored in the memory, and the at least one program is loaded and executed by the processor to implement the content operation method as described in the above aspect.
另一方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有至少一条指令,所述至少一条指令被处理器执行以实现如上述方面所述的内容操作方法。On the other hand, embodiments of the present application provide a computer-readable storage medium that stores at least one instruction, and the at least one instruction is executed by a processor to implement content operations as described above. method.
另一方面,本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述方面提供的内容操作方法。On the other hand, embodiments of the present application provide a computer program product. The computer program product includes computer instructions, and the computer instructions 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 computer device executes the content operation method provided by the above aspect.
附图说明Description of the drawings
图1是本申请一个示例性实施例提供的系统架构的示意图;Figure 1 is a schematic diagram of the system architecture provided by an exemplary embodiment of the present application;
图2是本申请一个示例性实施例提供的内容操作方法的流程图;Figure 2 is a flow chart of a content operation method provided by an exemplary embodiment of the present application;
图3示出了本申请一个示例性实施例提供的内容操作方法的示意图;Figure 3 shows a schematic diagram of a content operation method provided by an exemplary embodiment of the present application;
图4示出了本申请另一个示例性实施例提供的内容操作方法的流程图;Figure 4 shows a flow chart of a content operation method provided by another exemplary embodiment of the present application;
图5示出了本申请另一个示例性实施例提供的采用了时间梯度的候选任务排列;Figure 5 shows a candidate task arrangement using temporal gradients provided by another exemplary embodiment of the present application;
图6示出了本申请另一个示例性实施例提供的采用了时间梯度的内容处理方法的示意图;Figure 6 shows a schematic diagram of a content processing method using temporal gradient provided by another exemplary embodiment of the present application;
图7示出了本申请一个示例性实施例提供的更新机器人候选集方法的流程图;Figure 7 shows a flow chart of a method for updating a robot candidate set provided by an exemplary embodiment of the present application;
图8是本申请一个示例性实施例提供的更新机器人候选集方法的示意图;Figure 8 is a schematic diagram of a method for updating a robot candidate set provided by an exemplary embodiment of the present application;
图9示出了本申请一个示例性实施例提供的一种内容操作的完整流程图;Figure 9 shows a complete flow chart of a content operation provided by an exemplary embodiment of the present application;
图10示出了本申请一个示例性实施例提供的内容操作装置的结构框图。Figure 10 shows a structural block diagram of a content operating device provided by an exemplary embodiment of the present application.
具体实施方式Detailed ways
随着社交软件的快速普及,越来越多的人开始用社交软件来记录和分享生活,每天都有大量的发布内容被生产,但这些内容的质量差异很大,大众更青睐于优质有趣的内容,导致那些比较普通的内容得不到观看和交互,这大大打击了用户发布内容的积极性。With the rapid popularity of social software, more and more people are beginning to use social software to record and share their lives. A large amount of published content is produced every day, but the quality of this content varies greatly. The public prefers high-quality and interesting content. Content, resulting in those relatively ordinary contents not being viewed and interacted with, which greatly discourages users from publishing content.
有鉴于此,本申请实施例中,服务器从队列中获取到候选任务后,从候选任务中确定目标任务,并从目标任务指示目标发布内容对应的目标机器人候选集中确定目标机器人,进而通过目标机器人对目标发布内容执行操作;采用本申请实施例提供的方案,可实现在预设时间点自动完成对发布内容的操作,有助于提高内容操作的效率。图1示出了本申请一个示例性实施例提供的系统架构的示意图。In view of this, in the 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 task instruction target release content, and then uses the target robot Perform operations on the target published content; using the solution provided by the embodiments of this application, the operation on the published content can be automatically completed at a preset time point, which helps to improve the efficiency of content operations. Figure 1 shows a schematic diagram of the system architecture provided by an exemplary embodiment of the present application.
该系统架构可以包括:终端设备110和服务器120,其中,终端设备110中安装有可发布内容的社交软件。The system architecture may include: a terminal device 110 and a server 120, wherein the terminal device 110 is installed with social software that can publish content.
终端设备110的数量通常为多个,每一个服务器120可以与多个终端设备110实现交互。终端设备110用于发布内容及对发布内容进行操作,该操作可以为编辑、删除、点赞和转发等。 The number of terminal devices 110 is usually multiple, and each server 120 can interact with multiple terminal devices 110 . The terminal device 110 is used to publish content and perform operations on the published content. The operations may include editing, deleting, liking, forwarding, etc.
服务器120是社交软件的后台服务器,主要用于对终端设备110上传的内容进行发布、进行内容推荐等等。比如,将视频发布到视频分享平台。The server 120 is a backend server for social software, and is mainly used to publish content uploaded by the terminal device 110, make content recommendations, and so on. For example, post a video to a video sharing platform.
本申请实施例中,服务器120还用于对发布内容及其执行操作的时间点进行关联存储。终端设备110发布内容后,服务器120将发布内容及其对应的时间点存储至队列中,并对发布内容生成对应的机器人候选集。服务器120从队列中获取候选任务,从候选任务中确定目标任务,并从目标任务指示目标发布内容对应的目标机器人候选集中确定目标机器人,进而通过目标机器人对目标发布内容执行操作。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 content, the server 120 stores the published content and its 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 release content indicated by the target task, and then uses the target robot to perform operations on the target release content.
请参考图2,其示出了本申请一个示例性实施例提供的内容操作方法的流程图,该方法可以包括如下步骤:Please refer to Figure 2, which shows a flow chart of a content operation method provided by an exemplary embodiment of the present application. The method may include the following steps:
步骤201,从目标队列中获取n条候选任务,候选任务用于指示机器人在候选时间点对候选发布内容执行操作,n为正整数。Step 201: Obtain n candidate tasks from the target queue. The candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time points, and n is a positive integer.
在一种可能的实施方式中,发布内容的内容形态可以是视频、文章、图片、音乐、动态等,本申请实施例并不对具体的内容形态构成限定。In a possible implementation, the content form of the published content may be videos, articles, pictures, music, dynamics, etc. The embodiments of this application do not limit the specific content form.
服务器通过机器人对发布内容进行操作,该机器人指具有真实用户信息的一些虚拟用户。The server operates the published content through robots, which refer to some virtual users with real user information.
为了能够有序的对发布内容执行操作,在一种可能的实施方式中,服务器将发布内容及其对应的操作时间点存储在队列中,一条发布内容及其对应的时间点为一条候选任务,需要执行操作时,服务器从目标队列中获取n条候选任务,n为正整数。In order to be able to perform operations on published content in an orderly manner, in one possible implementation, the server stores the published content and its corresponding operation time point in the 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.
其中,该候选任务用于指示机器人在候选时间点对候选发布内容执行操作,机器人指具有真实用户信息的一些虚拟用户。Among them, the candidate task is used to instruct the robot to perform operations on the candidate release content at the candidate time point. The robot refers to some virtual users with real user information.
步骤202,确定n条候选任务中的目标任务,目标任务所指示的目标时间点不晚于当前时间点。Step 202: Determine the 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.
服务器预先规定了每条任务执行操作的时间点,比如规定时间点为发布内容后的第1分钟、第2分钟、第3分钟、第5分钟、第10分钟等,服务器只执行到达执行操作的时间点的任务,服务器从目标队列中获取的n条候选任务,并不是全部都需要被执行操作的,在一种可能的实施方式中,需要对这n条候选任务进行筛选,筛选出时间点早于或等于当前时间点的候选任务并将其确定为需要执行操作的目标任务。The server pre-stipulates the time points for each task execution operation. For example, the specified time points are the 1st minute, 2nd minute, 3rd minute, 5th minute, 10th minute, etc. after the content is published. The server only executes the execution time when the operation is reached. For tasks at a time point, not all of the n candidate tasks obtained by the server from the target queue need to be executed. In a possible implementation, the n candidate tasks need to be screened to filter out the time point. Candidate tasks that are earlier than or equal to the current time point are identified as target tasks that require action.
步骤203,从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,目标机器人候选集中包含用于对目标发布内容执行操作的机器人。Step 203: Determine the target robot from the target robot candidate set corresponding to the target published content indicated by the target task. The target robot candidate set includes robots used to perform operations on the target published content.
服务器预先生成一个机器人候选总集,对应发布内容从总集中获取对发布内容执行操作的机器人生成机器人候选集,为避免不同机器人候选集之间出现大规模的重叠,服务器采用随机获取的方式生成机器人候选集。The server generates a total set of robot candidates in advance. Corresponding to the published content, the robots that perform operations on the published content are obtained from the total set to generate a robot candidate set. In order to avoid large-scale overlap between different robot candidate sets, the server uses random acquisition to generate robots. candidate set.
其中,不同的机器人候选集之间可以完全不同,也可以部分重叠,机器人候选集中的机器人可执行不同操作,比如,一部分机器人执行观看操作,一部分机器人执行点赞操作等。Among them, different robot candidate sets can be completely different or partially overlap. The robots in the robot candidate set can perform different operations. For example, some robots perform viewing operations, and some robots perform like operations.
可选的,服务器可以采用预先生成机器人候选集的做法,也可使用即时生 成的方法,即在到达任务执行操作的时间点时再随机生成机器人候选集。Optionally, the server can generate a robot candidate set in advance or generate a robot candidate set on-the-fly. This method is to randomly generate a robot candidate set when the time point of task execution is reached.
服务器从候选任务中确定目标任务后,响应于目标任务指示的目标发布内容,从目标发布内容对应的目标机器人候选集中确定出目标机器人,目标机器人候选集中包含用于对目标发布内容执行操作的机器人。After the server determines the target task from the candidate tasks, in response to the target release content indicated by the target task, it determines the target robot from the target robot candidate set corresponding to the target release content. The target robot candidate set includes robots used to perform operations on the target release content. .
可选的,服务器从目标发布内容对应的目标机器人候选集中确定出目标机器人的方式可以是随机,也可以是顺序,本实施例对此不作限定。Optionally, the server determines 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.
可选的,机器人候选集中的机器人可以为固定执行某一操作的机器人,比如点赞机器人只能执行点赞操作,评论机器人只能执行评论操作,从机器人候选总集中生成机器人候选集时依据发布内容分配不同的机器人组成机器人候选集,比如一个发布内容需要100个机器人观看,20个机器人评论,那就从机器人候选总集中随机获取100个观看机器人和20个评论机器人组成机器人候选集,若当前操作时间点目标发布内容需要进行的操作为观看操作,则服务器从机器人候选集中确定一个观看机器人。Optionally, the robots in the robot candidate set can be robots that perform a certain operation. For example, a like robot can only perform a like operation, and a comment robot can only perform a comment operation. The robot candidate set is generated from the total robot candidate set according to the release Robots with different content allocations form a robot candidate set. For example, if a content release requires 100 robots to watch and 20 robots to comment, then 100 viewing robots and 20 commenting robots are randomly obtained from the total robot candidate set to form a robot candidate set. If the current The operation required to publish the content at the operation time point is a viewing operation, and the server determines a viewing robot from the robot candidate set.
可选的,机器人候选集中的机器人也可以为执行任一操作的机器人,比如任一机器人既可以执行点赞操作,也可以执行评论操作,从机器人候选总集中生成机器人候选集时依据发布内容分配机器人组成机器人候选集即可,比如一个发布内容需要100个机器人观看,20个机器人评论,那就从机器人候选总集中随机获取120个机器人组成机器人候选集,若当前操作时间点目标发布内容需要进行的操作为观看,则服务器从机器人候选集中确定任一机器人即可。Optionally, the robots in the robot candidate set can also be robots that perform any operation. For example, any robot can perform either a like operation or a comment operation. When generating a robot candidate set from the total robot candidate set, the robot candidate set is allocated according to the published content. Robots can form a robot candidate set. For example, if a published content requires 100 robots to watch and 20 robots to comment, then 120 robots are randomly obtained from the total robot candidate set to form a robot candidate set. If the target publishing content at the current operation time point needs to be If the operation is viewing, the server can determine any robot from the robot candidate set.
步骤204,通过目标机器人对目标发布内容执行操作。Step 204: Use the target robot to perform operations on the target published content.
在一种可能的实施方式中,基于目标发布内容从对应的目标机器人候选集中确定目标机器人后,通过目标机器人对目标发布内容执行操作。In a possible implementation, after the target robot is determined from the corresponding target robot candidate set based on the target published content, the target robot performs operations on the target published content.
可选的,该操作可以为观看操作、点赞操作、分享操作、收藏操作、评论操作、转发操作等,本实施例对此不作限定。Optionally, the operation may be a viewing operation, a like operation, a sharing operation, a collection operation, a comment operation, a forwarding operation, etc., which are not limited in this embodiment.
示意性的,如图3所示,目标队列中共有m条候选任务,服务器从中获取n条候选任务,并基于这n条候选任务的时间点确定目标任务,其中m和n都是正整数且m大于等于n,服务器从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,目标机器人对发布内容进行操作,若服务器从n条候选任务中确定内容1对应的候选任务为目标任务,则服务器从内容1对应的机器人候选集中确定一机器人作为目标机器人对内容1执行操作。若内容1对应的机器人候选集中有机器人1、2、3……当内容1在执行操作时间点时需要执行操作,则服务器会从机器人1、2、3……中确定机器人作为目标机器人对内容1执行操作。Schematically, as shown in Figure 3, there are m candidate tasks in the target queue, the server obtains n candidate tasks from it, 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 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 the candidate task corresponding to content 1 from n candidate tasks as the target task, Then 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 the robot candidate set corresponding to content 1 includes robots 1, 2, 3... When content 1 needs to perform an operation at the execution time point, the server will determine the robot from robots 1, 2, 3... as the target robot for the content. 1Perform the operation.
综上所述,本申请实施例中,服务器从目标队列中获取n条候选任务后,确定n条候选任务中的目标任务,进而从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,通过目标机器人对目标发布内容执行操作;采用本申请实施例提供的方案,可实现在预设时间点自动完成对发布内容的操作,有助于提高内容操作的效率以及准确性。To sum up, in the embodiment of this 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 from the target robot candidate set corresponding to the target release content indicated by the target task. The robot performs operations on the target published content through the target robot; using the solution provided by the embodiment of the present application, the operation on the published content can be automatically completed at a preset time point, which helps to improve the efficiency and accuracy of content operations.
为了能够更简单高效的对发布内容、发布内容执行操作的时间点及发布内 容对应的机器人候选集进行存储和获取,在一种可能的实施方式中,发布内容与对应的机器人候选集采用key-value形式存储在redis缓存中,其中,key为发布内容的内容标识,value为所述机器人候选集中各个机器人的机器人标识;任务以score-member形式存储在zset队列中,其中,score为机器人对发布内容执行操作的时间点,member为发布内容的内容标识。In order to make it easier and more efficient to publish content, the time point at which operations are performed on the published content, and the contents of the published content, The corresponding robot candidate set is stored and obtained. In one possible implementation, the published content and the corresponding robot candidate set are stored in the redis cache in the form of key-value, where key is the content identifier of the published content, and value is the robot identification of each robot in the robot candidate set; the task is stored in the zset queue in the form of score-member, where score is the time point when the robot performs operations on the published content, and member is the content identification of the published content.
在一种可能的实施方式中,用户可以通过在终端上增加发布内容或删除发布内容向服务器发送内容发布指令或内容删除指令,下面对着两种情况进行示意性说明。In a possible implementation, the user can send a content publishing instruction or a content deletion instruction to the server by adding published content or deleting published content on the terminal. The two situations are schematically explained below.
1、增加发布内容1. Add publishing content
在一种可能的实施方式中,用户通过终端进行内容发布时,服务器将此发布内容确定为第一发布内容,服务器响应于第一发布内容对应的内容发布指令,为第一发布内容生成第一机器人候选集,生成第一机器人候选集的方式可以参考步骤203,本实施例在此不再赘述,第一机器人候选集中包含用于对第一发布内容执行操作的机器人,服务器基于第一发布内容以及第一发布内容对应的时间梯度信息,生成第一发布内容对应的第一任务,服务器基于负载均衡策略将所述第一任务添加至队列中。In a possible implementation, when a user publishes content through a terminal, the server determines the published content as the first published content, and the server generates a first published content for the first published content in response to a content publishing instruction corresponding to the first published content. Robot candidate set. The method of generating the first robot candidate set can refer to step 203. This embodiment will not be repeated here. The first robot candidate set includes robots used to perform operations on the first published content. The server is based on the first published content. and time gradient information corresponding to the first published content, to generate a first task corresponding to the first published content, and the server adds the first task to the queue based on the load balancing policy.
可选的,时间梯度信息指服务器将第一发部内容的N个操作时间点及在对应时间点的执行操作按照时间点从小到大的方式进行排列得到的信息。Optionally, the time gradient information refers to the information obtained by the server arranging the N operation time points of the first content and the execution operations at the corresponding time points from small to large time points.
可选的,第一任务由第一发布内容及其对应的时间点组成。Optionally, the first task consists of the first release content and its corresponding time point.
可选的,负载均衡策略主要分为静态和动态两类。静态负载均衡以固定的概率分配任务,不考虑服务器的状态信息,如轮转算法均衡、加权轮转算法均衡等,动态负载均衡以服务器的实时负载状态信息来决定任务的分配,如最小连接法均衡、加权最小连接法均衡等,本申请实施例并不对具体的负载均衡策略方式构成限定。Optional, 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 algorithm balancing, weighted round-robin algorithm balancing, etc. Dynamic load balancing uses the real-time load status information of the server to determine task allocation, such as minimum connection method balancing, Weighted least connection method balancing, etc., the embodiments of this application do not limit the specific load balancing strategy.
2、删除发布内容2. Delete published content
在另一种可能的实施方式中,用户通过终端删除已发布的内容时,服务器将此发布内容确定为第二发布内容,响应于第二发布内容对应的内容删除指令,服务器删除第二发布内容与第二机器人候选集的对应关系,从队列中删除第二发布内容对应的第二任务。In another possible implementation, when the user deletes published content through the terminal, the server determines the published content as the second published content, and in response to the content deletion instruction corresponding to the second published content, the server deletes the second published content The second task corresponding to the second published content is deleted from the queue according to the corresponding relationship with the second robot candidate set.
可选的,第二任务由第二发布内容及其对应的时间点组成。Optionally, the second task consists of the second release content and its corresponding time point.
可选的,服务器删除第二发布内容与第二机器人候选集的对应关系,可以是删除第二机器人候选集或清空第二机器人候选集内的机器人,第二机器人候选集不存在或第二机器人候选集为空时,服务器从队列中删除第二发布内容对应的第二任务。Optionally, the server deletes the corresponding relationship between the second published content and the second robot candidate set, which can be by deleting the second robot candidate set or clearing the robots in the second robot candidate set. The second robot candidate set does not exist or the second robot candidate set does not exist. When the candidate set is empty, the server deletes the second task corresponding to the second published content from the queue.
由于社交软件上内容的发布量很大,本申请实施例中将目标队列中的候选任务按照时间点的先后顺序进行排列,以便机器人能够更精准且及时的对发布内容进行操作。请参考图3,其示出了本申请另一个示例性实施例提供的内容操作方法的流程图,该方法可以包括如下步骤:Due to the large amount of content published on social software, in the embodiment of this application, the candidate tasks in the target queue are arranged in the order of time points, so that the robot can operate the published content more accurately and timely. Please refer to Figure 3, which shows a flow chart of a content operation method provided by another exemplary embodiment of the present application. The method may include the following steps:
步骤401,获取目标队列中的前n条候选任务。 Step 401: Obtain the first n candidate tasks in the target queue.
在一种可能的实施方式中,服务器将目标队列中的候选任务存储在zset队列中,本申请实施例中,score为机器人对发布内容执行操作的时间点,member为发布内容的内容标识,服务器将候选任务存储至zest后,zest依据score对member进行排序,即zest依据机器人对发布内容执行操作的时间点对发布内容的内容标识进行排序,排序后目标队列中的候选任务按照时间点的先后顺序排列,服务器获取目标队列中的前n条候选任务,n为正整数。In a possible implementation, the server stores the candidate tasks in the target queue in the zset queue. In the embodiment of this application, score is the time point when the robot performs operations on the published content, member is the content identifier of the published content, and the server After the candidate tasks are stored in zest, zest sorts the members according to the score. That is, zest sorts the content identifiers 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 order of time points. Arranged in order, the server obtains the first n candidate tasks in the target queue, n is a positive integer.
示意性的,如图5所示,zset队列之前存储有四条候选任务,若此时队列中写入量条候选任务,zset队列将依据候选任务的时间点对队列重新进行排序,排序后的候选任务按照时间点的先后顺序排列存储在zset队列中。Schematically, as shown in Figure 5, the zset queue previously stored four candidate tasks. If a candidate task is written into the queue at this time, the zset queue will reorder the queue according to the time point of the candidate task. The sorted candidates Tasks are stored in the zset queue in order of time points.
步骤402,基于n条候选任务的排列顺序,按序比较候选任务所指示的候选时间点与当前时间点,得到目标任务。Step 402: Based on the order of n candidate tasks, compare the candidate time points indicated by the candidate tasks with the current time point in order to obtain the target task.
在一种可能的实施方式中,服务器获取目标队列中的前n条候选任务后,对候选任务的候选时间点及当前时间点按照候选任务的排列顺序进行比较,得到候选时间点早于或等于当前时间点的候选任务并将其作为目标任务。In a possible implementation, after the server obtains the first n candidate tasks in the target queue, it compares the candidate time points of the candidate tasks and the current time point in the order of the candidate tasks, and obtains that the candidate time points are earlier than or equal to Candidate tasks at the current time point and use them as target tasks.
可选的,由于这n条候选任务按照时间点的先后顺序排列,若第i条候选任务晚于当前时间点,则第i条之后的候选任务都晚于当前时间点,将不再对后续候选任务进行比较。Optional, since these n candidate tasks are arranged in the order of time points, if the i-th candidate task is later than the current time point, then the candidate tasks after the i-th task are all later than the current time point, and subsequent tasks will no longer be considered. Candidate tasks are compared.
步骤403,在不存在目标任务的情况下,基于n条候选任务中第一条候选任务所指示的候选时间点以及当前时间点,确定休眠时长。Step 403: If 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.
在一种可能的实施方式中,服务器获取目标队列中的前n条候选任务并对候选任务的候选时间点及当前时间点按照候选任务的排列顺序进行比较后,判断出这n条候选任务全部晚于当前时间点,即不存在目标任务。In a possible implementation, the server obtains the first n candidate tasks in the target queue and compares the candidate time points of the candidate tasks with the current time point according to the order of the candidate tasks, and then determines that all n candidate tasks are Later than the current time point, that is, the target task does not exist.
可选的,由于这n条候选任务按照时间点的先后顺序排列,第1条候选任务为这n条候选任务中时间最早的一条候选任务,若第1条候选任务晚于当前时间点,则这n条候选任务都晚于当前时间点,不再需要进行比较。Optionally, since the n candidate tasks are arranged in the order of 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 These n candidate tasks are all later than the current time point and no longer need to be compared.
为提高处理效率及减少cpu的消耗,本实施例中服务器基于n条候选任务中第一条候选任务所指示的候选时间点以及当前时间点,确定休眠时长。In order 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.
示例性的,如图6所示,目标队列中有m条候选任务,这m条候选任务时间点的先后顺序排列,服务器获取目标队列中的前n条候选任务,其中n和m都是正整数且m大于等于n,进而基于n条候选任务的排列顺序,按序比较候选任务所指示的候选时间点与当前时间点,若当前时间点为11:59:00,则这n条候选任务中的第一条候选任务的时间点都晚于当前时间点,不存在目标任务,基于当前时间点11:59:00和候选任务所指示的时间点12:00:00计算出休眠时长t,t为00:01:00。For example, as shown in Figure 6, there are m candidate tasks in the target queue. The time points of these m candidate tasks are arranged in 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, and then based on the order of n candidate tasks, sequentially compare the candidate time points indicated by the candidate tasks with the current time point. If the current time point is 11:59:00, then among the n candidate tasks The time points of the first candidate task are all later than the current time point, and there is no target task. The sleep duration t, t is calculated based on the current time point 11:59:00 and the time point 12:00:00 indicated by the candidate task. is 00:01:00.
步骤404,在休眠时长内,停止从目标队列中获取候选任务。Step 404: Stop obtaining candidate tasks from the target queue during the sleep period.
在休眠时长内,服务器控制通过机器人对发布内容进行操作的进程休眠,停止从目标队列中获取候选任务。During the sleep period, the server controls the process of operating the published content through the robot to sleep and stops obtaining candidate tasks from the target queue.
步骤405,在达到休眠时长的情况下,继续从目标队列中获取候选任务。Step 405: When the sleep duration is reached, continue to obtain candidate tasks from the target queue.
达到休眠时长后,服务器控制通过机器人对发布内容进行操作的进程恢复 运行状态,由于服务器是基于第一条候选任务所指示的候选时间点以及当前时间点确定的休眠时长,通过机器人对发布内容进行操作的进程恢复运行状态后,继续从目标队列中获取候选任务,此时候选任务中至少有一条候选任务早于或等于当前时间点,可以被执行操作。After the dormancy period is reached, the server controls the process of operating the published content through the robot to resume. Running status. Since the server is based on the candidate time point indicated by the first candidate task and the sleep duration determined at the current time point, after the process of operating the published content through the robot resumes the running status, it continues to obtain candidate tasks from the target queue. At this time, at least one candidate task among the candidate tasks is earlier than or equal to the current time point and can be executed.
步骤406,在存在目标任务的情况下,从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人。Step 406: If a target task exists, determine the target robot from the target robot candidate set corresponding to the target release content indicated by the target task.
在一种可能的实施方式中,服务器获取目标队列中的前n条候选任务并对候选任务的候选时间点及当前时间点按照候选任务的排列顺序进行比较后,得到i条候选任务晚于当前时间点,即第i条及其之前的候选任务都早于或等于当前时间点,第i条之后的候选任务都晚于当前时间点,取前i条候选任务并将其作为目标任务,从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人。In a possible implementation, the server obtains the first n candidate tasks in the target queue and compares the candidate time points of the candidate tasks and the current time point according to the order of the candidate tasks, and obtains that the i candidate tasks are later than the current time point. Time point, that is, the i-th candidate task and the candidate tasks before it are all earlier than or equal to the current time point, and the candidate tasks after the i-th item are all later than the current time point. Take the first i candidate task and use it as the target task, from The target robot is determined from the target robot candidate set corresponding to the target release content indicated by the target task.
示例性的,如图6所示,若当前时间点为12:00:11,则内容4对应的候选任务及其之前的候选任务的时间点都早于或等于当前时间点,内容4对应的候选任务之后的候选任务的时间点都晚于当前时间点,将内容4对应的候选任务及其之前的候选任务作为目标任务,进而从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人。For example, as shown in Figure 6, if the current time point is 12:00:11, then 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 corresponding to content 4 The time points of the candidate tasks after the candidate task are all later than the current time point. The candidate task corresponding to content 4 and the candidate tasks before it are regarded as the target tasks, and then the target is determined from the target robot candidate set corresponding to the target release content indicated by the target task. robot.
步骤407,通过目标机器人对目标发布内容执行操作。Step 407: Use the target robot to perform operations on the target published content.
本步骤的实施方式可以参考步骤204,本实施例在此不再赘述。For the implementation of this step, reference may be made to step 204, which will not be described again in this embodiment.
本实施例中,将目标任务按待操作的时间点的先后顺序排序,并根据最小的时间点与当前时间点进行比较,存在目标任务的情况下,对发布内容进行操作,不存在目标任务的情况下,计算休眠的时间,待休眠时长结束后再进行操作,在准确完成操作的同时,减少了无用的读写操作,实现了休眠策略,极大的提高了处理效率,减少cpu消耗。In this embodiment, the target tasks are sorted in the order of time points to be operated, and the smallest time point is compared with the current time point. If the target task exists, the published content is operated, and if there is no target task, the published content is operated. In this case, the sleep time is calculated and the operation is performed after the sleep period is over. While the operation is completed accurately, useless read and write operations are reduced, the sleep strategy is implemented, the processing efficiency is greatly improved, and the CPU consumption is reduced.
为了避免出现重复机器人对目标发布内容执行操作的情况,本实施例中采用从目标机器人候选集中移除已经操作过的机器人的方式来更新候选集,请参考图7,其示出了本申请一个示例性实施例提供的机器人候选集更新过程的流程图,该方法可以包括如下步骤。In order to avoid the situation where repeated robots perform operations on the target published content, in this embodiment, the candidate set is updated by removing robots that have already operated from the target robot candidate set. Please refer to Figure 7, which shows a The exemplary embodiment provides a flow chart of a robot candidate set updating process. The method may include the following steps.
步骤701,从目标机器人候选集中移除目标机器人。Step 701: Remove the target robot from the target robot candidate set.
在一种可能的实施方式中,发布内容与对应的机器人候选集采用key-value形式存储在redis缓存中,其中,key为发布内容的内容标识,value为所述机器人候选集中各个机器人的机器人标识,在目标机器人对目标发布内容执行操作后,服务器通过从目标机器人候选集中移除目标机器人的方式更新目标机器人候选集,即更新内容标识key对应的机器人标识value,服务器将更新后的机器人候选集对应的value写回redis缓存。In a possible implementation, the published content and the corresponding robot candidate set are stored in the redis cache in the form of key-value, 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. , after the target robot performs operations 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, updating the robot identification value corresponding to the content identification key, and the server will update the robot candidate set The corresponding value is written back to the redis cache.
示意性的,如图8所示,由机器人对内容执行操作后,通过从内容对应的机器人候选集中移除机器人的方式更新机器人候选集,将更新后的机器人候选集写回redis缓存。Schematically, as shown in Figure 8, after a 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.
步骤702,在目标机器人候选集为空的情况下,从目标队列中移除目标任务。 Step 702: When the target robot candidate set is empty, remove the target task from the target queue.
在一种可能的实施方式中,若目标机器人候选集更新后,目标机器人候选集中无未操作的机器人即目标机器人候选集为空时,表明目标任务所指示的目标发布内容的所有时间点都已完成操作,此目标任务不再需要进行机器人操作,将此目标任务从目标队列中移除。In a possible implementation, if after the target robot candidate set is updated, there are no unoperated robots in the target robot candidate set, that is, when 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 After the operation is completed, this target task no longer requires robot operation, and this target task is removed from the target queue.
示意性的,如图8所示,机器人4对内容4执行操作后,服务器通过从内容2对应的机器人候选集中移除机器人4的方式更新机器人候选集,内容2对应的机器人候选集更新后,由于机器人候选集中无未操作的机器人即机器人候选集为空,表明内容2的所有时间点都已完成操作,内容2对应的目标任务不再需要进行机器人操作,将此内容2对应的目标任务从目标队列中移除。Schematically, as shown in Figure 8, 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 are no unoperated robots in the robot candidate set, that is, the robot candidate set is empty, it indicates that the operations have been completed at all time points of content 2. The target task corresponding to content 2 no longer requires robot operation. The target task corresponding to content 2 is removed from the robot candidate set. removed from the target queue.
步骤703,在目标机器人候选集不为空的情况下,基于目标发布内容对应的时间梯度信息,更新目标任务所指示的目标时间点。Step 703: If the target robot candidate set is not empty, update the target time point indicated by the target task based on the time gradient information corresponding to the target release content.
在另一种可能的实施方式中,若目标机器人候选集更新后,目标机器人候选集中存在未操作的机器人即目标机器人候选集不为空时,表明目标任务所指示的目标发布内容还存在时间点未完成操作,基于目标发布内容对应的时间梯度信息,计算最接近当前时间点的下一次需要操作的时间点,将其作为目标时间点更新至目标任务中。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, when the target robot candidate set is not empty, it indicates that the target release content indicated by the target task still exists at a time point. For unfinished operations, based on the time gradient information corresponding to the target release content, calculate the next time point that requires the operation closest to the current time point, and update it to the target task as the target time point.
示意性的,如图8所示,由机器人1对内容1执行操作后,通过从内容1对应的机器人候选集中移除机器人1的方式更新机器人候选集,内容1对应的机器人候选集更新后,由于机器人候选集中存在未操作的机器人即机器人候选集不为空,表明内容1还存在时间点未完成操作,基于内容1对应的时间梯度信息,计算出最接近当前时间点的下一次需要操作的时间点为12:00:07,将时间点12:00:07更新至目标任务中。Schematically, as shown in Figure 8, 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 unoperated robots in the robot candidate set, that is, the robot candidate set is not empty, it indicates that content 1 still has unfinished operations at time points. Based on the time gradient information corresponding to content 1, the next operation that needs to be performed closest to the current time point is calculated. The time point is 12:00:07. Update the time point 12:00:07 to the target task.
步骤704,将更新后目标任务写回目标队列。Step 704: Write the updated target task back to the target queue.
目标任务中的目标时间点更新完成后,服务器将更新后的目标任务写回目标队列,即将score更新后,服务器将member及其对应的score写回zset队列。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.
本实施例中,采用从目标机器人候选集中移除已经操作过的机器人的方式来更新候选集,避免同一机器人对同一目标内容进行重复的处理操作,尽可能给用户造成更好的体验,同时,在目标机器人候选集为空的情况下,从目标队列中移除目标任务,能够避免服务器对无效的目标任务进行读写,造成服务器运行出现错误。In this embodiment, the candidate set is updated by removing robots that have already been operated from the target robot candidate set, so as to avoid repeated processing operations on the same target content by the same robot, and to provide users with a better experience as much as possible. At the same time, When the target robot candidate set is empty, removing the target task from the target queue can prevent the server from reading and writing invalid target tasks, causing errors in server operation.
为了保证同一时刻不同队列可同时触发机器人操作,在一种可能的实施方式中,采用队列处理线程抢占分布式锁的方式对队列中发布内容进行操作In order to ensure that different queues can trigger robot operations at the same time, in one possible implementation, the queue processing thread is used to seize distributed locks to operate the content published in the queue.
为保证每个队列处理线程只处理一个队列且一个队列同时只能被一个队列处理线程处理,在一种可能的实施方式中,通过使用分布式锁的方式,每个队列对应一个分布式锁,队列处理线程抢占到目标队列的分布式锁后,成为目标队列处理线程,目标队列处理进程从目标队列中获取n条候选任务。In order to ensure that each queue processing thread only processes one queue and that one queue can only be processed by one queue processing thread at the same time, in a possible implementation, by using distributed locks, 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. The target queue processing process obtains n candidate tasks from the target queue.
可选的,为保证容灾性,即目标队列处理进程出现异常,不能正常工作,本申请实施例中分配了多于队列个数的队列处理进程,但只有抢占到队列对应的分布式锁的队列处理进程能正常处理队列。 Optionally, in order to ensure disaster tolerance, that is, the target queue processing process is abnormal and cannot work normally, in the embodiment of this application, more queue processing processes than the number of queues are allocated, but only those that seize the distributed lock corresponding to the queue are allocated. The queue processing process can handle the queue normally.
可选的,分布式锁具有以下特性:Optionally, distributed locks have the following features:
1、在分布式锁环境下,一个队列在同一时间只能被一个线程执行;1. In a distributed lock environment, a queue can only be executed by one thread at the same time;
2、高可用的获取锁与释放锁;2. Highly available lock acquisition and lock release;
3、高性能的获取锁与释放锁;3. High-performance lock acquisition and lock release;
4、具备可重入特性;4. It has reentrant characteristics;
5、具备锁失效机制,防止死锁,即设置锁失效时长,到达锁失效时长后,锁被释放;5. It has a lock failure mechanism to prevent deadlock, that is, setting the lock failure time, and after reaching the lock failure time, the lock is released;
6、具备非阻塞锁特性,即没有获取到锁将直接返回获取锁失败。6. It has non-blocking lock characteristics, that is, if the lock is not acquired, it will directly return failure to acquire the lock.
其中,分布式锁具有三种实现方式,分别为基于数据库实现分布式锁、基于缓存(Redis等)实现分布式锁及基于Zookeeper(一个分布式的,开放源码的分布式应用程序协调服务,是一个分布式服务框架)实现分布式锁,本实施例对此不作限定。Among them, distributed locks have three implementation methods, namely distributed locks based on database, distributed locks based on cache (Redis, etc.), and distributed locks based on Zookeeper (a distributed, open source distributed application coordination service, which is a Distributed service framework) implements distributed locks, which is not limited in this embodiment.
在一种可能的实施方式中,在目标队列处理线程抢占到目标队列对应的目标分布式锁的情况下,目标队列处理线程每隔第二时长对进行续锁操作。In a possible implementation, when the target queue processing thread preempts the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation on the pair every second time period.
可选的,由于分布式锁中设置有锁失效时长,到达时间后分布式锁会被释放,因此,服务器预先设定第二时长,第二时长小于或等于锁失效时长,队列处理进程抢占到队列对应的分布式锁后,每间隔第二时长需要进行续锁操作,以免分布式锁被释放。Optionally, since the distributed lock is set with a lock expiration time, the distributed lock will be released after the time is reached. Therefore, the server presets a second time period. The second time period is less than or equal to the lock expiration time, and the queue processing process preempts it. After the distributed lock corresponding to the queue is obtained, the lock renewal operation needs to be performed every second interval to prevent the distributed lock from being released.
例如,锁失效时长为30s,服务器预先设定第二时长,第二时长小于或等于锁失效时长,第二时长可以为25s,为避免分布式锁因达到锁失效时长被释放,目标队列处理线程每隔第二时长即25s进行续锁操作,以便目标队列处理线程继续占有目标队列对应的目标分布式锁,继续处理目标队列。For example, if the lock expiration time is 30s, the server pre-sets the second time duration. The second time duration is less than or equal to the lock expiration time. The second time duration can be 25s. In order to prevent the distributed lock from being released due to reaching the lock expiration time, the target queue processing thread The lock renewal operation is performed every second period of time, that is, 25 seconds, 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.
在另一种可能的实施方式中,在所述目标队列处理线程存在异常的情况下,所述目标分布式锁被释放。In another possible implementation, when an exception occurs in the target queue processing thread, the target distributed lock is released.
在目标队列处理进程出现异常,不能正常工作时,目标队列处理线程无法继续占有目标队列对应的目标分布式锁,目标分布式锁被释放,由其余队列处理线程继续抢占。When an exception occurs in the target queue processing process and cannot work normally, the target queue processing thread cannot continue to occupy the target distributed lock corresponding to the target queue. The target distributed lock is released and other queue processing threads continue to preempt it.
在一种可能的实施方式中,在目标队列处理线程抢占到目标队列对应的目标分布式锁的情况下,通过目标队列处理线程,从目标队列中获取n条候选任务。但由于本申请实施例中分配了多于队列个数的队列处理进程,只有抢占到队列对应的分布式锁的队列处理进程能正常处理队列,没有抢占到队列对应的分布式锁的队列处理进程无法处理队列,因此,在另一种可能的实施方式中,在目标队列处理线程未抢占到分布式锁的情况下,控制目标队列处理线程进入休眠状态,休眠状态的持续时长为第一时长,在达到第一时长的情况下,唤醒目标队列处理线程,其中,唤醒后的目标队列处理线程继续抢占分布式锁。In a possible implementation, when the target queue processing thread preempts 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 this application, only the queue processing processes that have preempted the distributed lock corresponding to the queue can process the queue normally, and there are no queue processing processes that have preempted the distributed lock corresponding to the queue. The queue cannot be processed. 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 the sleep state, and the duration of the sleep state is the first duration, When the first duration is reached, the target queue processing thread is awakened, and the awakened target queue processing thread continues to seize the distributed lock.
可选的,未抢占到分布式锁的队列处理线程将进入休眠状态,并保持休眠状态一定时长,可设置此时长为15s、20s、30s等等,此时长为休眠时长。Optionally, the queue processing thread that has not preempted the distributed lock will enter the dormant state and remain dormant for a certain period of time. This period can be set to 15s, 20s, 30s, etc., and this period is the dormancy duration.
本实施例中,分配多于队列数的队列处理进程,并使用分布式锁,保证每个队列都能被处理,同时在队列处理进程出现异常后,分布式锁会被释放,由 其余队列处理进程抢占分布式锁并继续处理队列,同时,通过设置休眠时长避免未抢占到分布式锁的队列处理线程进行无用的抢占操作,在使服务器高效可靠的运行的同时,保证操作过程中的容灾性,降低了cpu的消耗。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. The remaining queue processing processes seize the distributed lock and continue to process the queue. At the same time, by setting the sleep duration, 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, it ensures that the operation process is Disaster tolerance reduces CPU consumption.
结合上述各个实施例,图9提供了一种内容操作的完整流程:Combined with the above embodiments, Figure 9 provides a complete process of content operation:
步骤901,响应于删除内容操作,删除发布内容与机器人候选集的对应关系。Step 901: In response to the content deletion operation, delete the correspondence between the published content and the robot candidate set.
步骤902,响应于发布内容操作,生成与发布内容机器人候选集。Step 902: In response to a content publishing operation, generate and publish a content robot candidate set.
步骤903,基于发布内容及其对应的时间梯度信息生成目标任务。Step 903: Generate a target task based on the published content and its corresponding time gradient information.
步骤904,基于负载均衡策略将目标任务添加至目标队列中。Step 904: Add the target task to the target queue based on the load balancing policy.
步骤905,队列处理线程抢占目标队列的分布式锁,若未获取锁,进入休眠状态,持续时长为第一时长。Step 905: The queue processing thread seizes the distributed lock of the target queue. If the lock is not obtained, it enters the sleep state for the first duration.
步骤906,达到第一时长后,唤醒队列处理线程,队列处理线程唤醒后继续抢占分布式锁。Step 906: After reaching the first duration, wake up the queue processing thread, and continue to seize the distributed lock after the queue processing thread wakes up.
步骤907,队列处理线程抢占目标队列的分布式锁,若已获取锁,每隔第二时长进行续锁操作。Step 907: The queue processing thread seizes the distributed lock of the target queue. If the lock has been acquired, the lock renewal operation is performed every second time.
步骤908,通过目标队列处理线程从目标队列中获取前n条候选任务。Step 908: Obtain the first n candidate tasks from the target queue through the target queue processing thread.
步骤909,基于n条候选任务的排列顺序,按序比较候选任务所指示的候选时间点与当前时间点,得到目标任务。Step 909: Based on the order of n candidate tasks, compare the candidate time points indicated by the candidate tasks with the current time point in order to obtain the target task.
步骤910,在不存在目标任务的情况下,基于n条候选任务中第一条候选任务所指示的候选时间点以及当前时间点,确定休眠时长。Step 910: If 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.
步骤911,在休眠时长内,停止从目标队列中获取候选任务。Step 911: Stop obtaining candidate tasks from the target queue during the sleep period.
步骤912,在达到休眠时长的情况下,继续从目标队列中获取候选任务。Step 912: When the sleep duration is reached, continue to obtain candidate tasks from the target queue.
步骤913,存在目标任务的情况下,从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人。Step 913: If there is a target task, determine the target robot from the target robot candidate set corresponding to the target release content indicated by the target task.
步骤914,通过目标机器人对目标发布内容执行操作。Step 914: Use the target robot to perform operations on the target published content.
步骤915,操作后通过从目标机器人候选集中移除目标机器人更新目标机器人候选集。Step 915: After the operation, update the target robot candidate set by removing the target robot from the target robot candidate set.
步骤916,目标机器人候选集不为空时,更新目标时间点,将更新后的目标任务写回目标队列。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.
步骤917,目标机器人候选集为空的情况下,从目标队列中移除目标任务。Step 917: If the target robot candidate set is empty, remove the target task from the target queue.
请参考图10,其示出了本申请一个实施例提供的内容操作装置的结构框图。该装置可以通过软件、硬件或者两者的结合实现成为服务器的全部或一部分。该装置包括:Please refer to Figure 10, which shows a structural block diagram of a content operating device provided by an embodiment of the present application. The device can be implemented as all or part of the server through software, hardware, or a combination of both. The device includes:
获取模块1001,配置为从目标队列中获取n条候选任务,所述候选任务用于指示机器人在候选时间点对候选发布内容执行操作,n为正整数;The acquisition module 1001 is configured to acquire n candidate tasks from the target queue. The candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, and n is a positive integer;
第一确定模块1002,配置为确定n条所述候选任务中的目标任务,所述目标任务所指示的目标时间点不晚于当前时间点;The first determination module 1002 is configured to determine 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;
第二确定模块1003,配置为从所述目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,所述目标机器人候选集中包含用于对所述目标发布内容执行操作的机器人; The second determination module 1003 is configured to determine the target robot from the 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 the target published content;
操作模块1004,配置为通过所述目标机器人对所述目标发布内容执行操作。The operation module 1004 is configured to perform operations on the target published content through the target robot.
可选的,所述目标队列中的所述候选任务按照时间点的先后顺序排列;Optionally, the candidate tasks in the target queue are arranged in order of time points;
所述获取模块1001,配置为:The acquisition module 1001 is configured as:
获取所述目标队列中的前n条所述候选任务;Obtain the first n candidate tasks in the target queue;
所述第一确定模块1002,配置为:The first determination module 1002 is configured as:
基于n条所述候选任务的排列顺序,按序比较所述候选任务所指示的候选时间点与当前时间点,得到所述目标任务。Based on the arrangement order of the n candidate tasks, the candidate time points indicated by the candidate tasks and the current time point are sequentially compared to obtain the target task.
可选的,所述装置还包括:Optionally, the device also includes:
第一休眠模块,配置为在不存在所述目标任务的情况下,基于n条所述候选任务中第一条候选任务所指示的候选时间点以及当前时间点,确定休眠时长;The first sleep module is configured to 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 when the target task does not exist;
所述获取模块1001,配置为:The acquisition module 1001 is configured as:
在所述休眠时长内,停止从所述目标队列中获取所述候选任务;Within the sleep duration, stop obtaining the candidate tasks from the target queue;
在达到所述休眠时长的情况下,继续从目标队列中获取所述候选任务。When the sleep duration is reached, continue to obtain the candidate task from the target queue.
可选的,所述装置还包括:Optionally, the device also includes:
机器人移除模块,配置为从所述目标机器人候选集中移除所述目标机器人;a robot removal module configured to remove the target robot from the target robot candidate set;
任务移除模块,配置为在所述目标机器人候选集为空的情况下,从所述目标队列中移除所述目标任务。A task removal module configured to remove the target task from the target queue when the target robot candidate set is empty.
可选的,所述装置还包括:Optionally, the device also includes:
任务更新模块,配置为在所述目标机器人候选集不为空的情况下,基于所述目标发布内容对应的时间梯度信息,更新所述目标任务所指示的所述目标时间点,所述时间梯度信息中包含对所述目标发布内容执行操作的时间点,且更新后的所述目标时间点晚于更新前的所述目标时间点;A task update module configured to update the target time point indicated by the target task based on the time gradient information corresponding to the target release content when the target robot candidate set is not empty, and the time gradient The information includes the time point at which the operation is performed on the target published content, and the target time point after the update is later than the target time point before the update;
将更新后所述目标任务写回所述目标队列。Write the updated target task back to the target queue.
可选的,所述获取模块1001,配置为:Optionally, the acquisition module 1001 is configured as:
通过目标队列处理线程,从所述目标队列中获取n条所述候选任务,所述目标队列处理线程具有所述目标队列对应的目标分布式锁。The n candidate tasks are obtained from the target queue through a target queue processing thread, which has a target distributed lock corresponding to the target queue.
可选的,队列处理线程的数量大于队列的数量;Optionally, the number of queue processing threads is greater than the number of queues;
所述获取模块1001,配置为在所述目标队列处理线程抢占到所述目标队列对应的所述目标分布式锁的情况下,通过所述目标队列处理线程,从所述目标队列中获取n条所述候选任务;The acquisition module 1001 is configured to acquire n items from the target queue through the target queue processing thread when the target queue processing thread preempts the target distributed lock corresponding to the target queue. The candidate tasks;
所述装置还包括:The device also includes:
第二休眠模块,配置为在所述目标队列处理线程未抢占到分布式锁的情况下,控制所述目标队列处理线程进入休眠状态,所述休眠状态的持续时长为第一时长;The second sleep module is configured to control the target queue processing thread to enter a sleep state when the target queue processing thread does not seize the distributed lock, and the duration of the sleep state is the first time length;
唤醒模块,配置为在达到所述第一时长的情况下,唤醒所述目标队列处理线程,其中,唤醒后的所述目标队列处理线程继续抢占分布式锁。The wake-up module is configured to wake up the target queue processing thread when the first duration is reached, wherein the wake-up target queue processing thread continues to seize the distributed lock.
可选的,在所述目标队列处理线程抢占到所述目标队列对应的所述目标分布式锁的情况下,所述目标队列处理线程每隔第二时长对进行续锁操作;Optionally, when the target queue processing thread preempts 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.
可选的,所述装置还包括:Optionally, the device also includes:
生成模块,配置为响应于第一发布内容对应的内容发布指令,为所述第一发布内容生成第一机器人候选集,所述第一机器人候选集中包含用于对所述第一发布内容执行操作的机器人;A generation 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, where the first robot candidate set includes information for performing operations on the first published content. robot;
所述生成模块,还配置为基于所述第一发布内容以及所述第一发布内容对应的时间梯度信息,生成所述第一发布内容对应的第一任务;The generation 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;
添加模块,配置为基于负载均衡策略将所述第一任务添加至队列中。Add a module configured to add the first task to the queue based on the load balancing policy.
可选的,所述装置还包括:Optionally, the device also includes:
删除模块,配置为响应于第二发布内容对应的内容删除指令,删除所述第二发布内容与第二机器人候选集的对应关系;a deletion 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;
所述删除模块,还配置为从队列中删除所述第二发布内容对应的第二任务。The deletion module is also configured to delete the second task corresponding to the second published content from the queue.
可选的,发布内容与对应的机器人候选集采用key-value形式存储在redis缓存中,其中,key为发布内容的内容标识,value为所述机器人候选集中各个机器人的机器人标识;Optionally, the published content and the corresponding robot candidate set are stored in the redis cache in 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;
任务以score-member形式存储在zset队列中,其中,score为机器人对发布内容执行操作的时间点,member为发布内容的内容标识。Tasks are stored in the zset queue in the form of score-member, where score is the time point when the robot performs operations on the published content, and member is the content identifier of the published content.
综上所述,本申请实施例中,服务器从目标队列中获取n条候选任务后,确定n条候选任务中的目标任务,进而从目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,通过目标机器人对目标发布内容执行操作;采用本申请实施例提供的方案,可实现在预设时间点自动完成对发布内容的操作,有助于提高内容操作的效率以及准确性。To sum up, in the embodiment of this 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 from the target robot candidate set corresponding to the target release content indicated by the target task. The robot performs operations on the target published content through the target robot; using the solution provided by the embodiment of the present application, the operation on the published content can be automatically completed at a preset time point, which helps to improve the efficiency and accuracy of content operations.
本申请实施例还提供了一种服务器,所述服务器包括处理器和存储器,所述存储器中存储有至少一段程序,所述至少一段程序被所述处理器加载并执行以实现如上述实施例所述的内容操作方法。An embodiment of the present application also provides a server. The server includes a processor and a memory. At least one program is stored in the memory. The at least one program is loaded and executed by the processor to implement the above embodiments. How to operate the content described above.
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有至少一段程序,所述至少一段程序被处理器执行以实现如上述实施例所述的内容操作方法。Embodiments of the present application also provide a computer-readable storage medium that stores at least one program, and the at least one program is executed by a processor to implement the content operation method as described in the above embodiments.
本申请实施例提供了一种计算机程序产品,该计算机程序产品包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该服务器设备执行上述实施例提供的内容操作方法。 Embodiments of the present application provide a computer program product. The computer program product includes computer instructions, and the computer instructions 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 by the above embodiments.

Claims (15)

  1. 一种内容操作方法,其中,所述方法包括:A content operation method, wherein the method includes:
    从目标队列中获取n条候选任务,所述候选任务用于指示机器人在候选时间点对候选发布内容执行操作,n为正整数;Obtain n candidate tasks from the target queue, the candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, n is a positive integer;
    确定n条所述候选任务中的目标任务,所述目标任务所指示的目标时间点不晚于当前时间点;Determine the 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;
    从所述目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,所述目标机器人候选集中包含用于对所述目标发布内容执行操作的机器人;Determine the target robot from the target robot candidate set corresponding to the target published content indicated by the target task, and the target robot candidate set includes robots used to perform operations on the target published content;
    通过所述目标机器人对所述目标发布内容执行操作。The target posted content is acted upon by the target bot.
  2. 根据权利要求1所述的方法,其中,所述目标队列中的所述候选任务按照时间点的先后顺序排列;The method according to claim 1, wherein the candidate tasks in the target queue are arranged in order of time points;
    所述从目标队列中获取n条候选任务,包括:Obtaining n candidate tasks from the target queue includes:
    获取所述目标队列中的前n条所述候选任务;Obtain the first n candidate tasks in the target queue;
    所述确定n条所述候选任务中的目标任务,包括:Determining the target task among the n candidate tasks includes:
    基于n条所述候选任务的排列顺序,按序比较所述候选任务所指示的候选时间点与当前时间点,得到所述目标任务。Based on the arrangement order of the n candidate tasks, the candidate time points indicated by the candidate tasks and the current time point are sequentially compared to obtain the target task.
  3. 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, further comprising:
    在不存在所述目标任务的情况下,基于n条所述候选任务中第一条候选任务所指示的候选时间点以及当前时间点,确定休眠时长;When the target task does not exist, 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;
    在所述休眠时长内,停止从所述目标队列中获取所述候选任务;Within the sleep duration, stop obtaining the candidate tasks from the target queue;
    在达到所述休眠时长的情况下,继续从目标队列中获取所述候选任务。When the sleep duration is reached, continue to obtain the candidate task from the target queue.
  4. 根据权利要求1至3任一所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further includes:
    从所述目标机器人候选集中移除所述目标机器人;Remove the target robot from the target robot candidate set;
    在所述目标机器人候选集为空的情况下,从所述目标队列中移除所述目标任务。If the target robot candidate set is empty, the target task is removed from the target queue.
  5. 根据权利要求4所述的方法,其中,所述从所述目标机器人候选集中移除所述目标机器人之后,所述方法还包括:The method according to claim 4, wherein after removing the target robot from the target robot candidate set, the method further includes:
    在所述目标机器人候选集不为空的情况下,基于所述目标发布内容对应的时间梯度信息,更新所述目标任务所指示的所述目标时间点,所述时间梯度信息中包含对所述目标发布内容执行操作的时间点,且更新后的所述目标时间点晚于更新前的所述目标时间点;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 release content, where the time gradient information includes the The time point at which the target published content performs the operation, and the target time point after the update is later than the target time point before the update;
    将更新后所述目标任务写回所述目标队列。 Write the updated target task back to the target queue.
  6. 根据权利要求1至3任一所述的方法,其中,所述从目标队列中获取n条候选任务,包括:The method according to any one of claims 1 to 3, wherein said obtaining n candidate tasks from the target queue includes:
    通过目标队列处理线程,从所述目标队列中获取n条所述候选任务,所述目标队列处理线程具有所述目标队列对应的目标分布式锁。The n candidate tasks are obtained from the target queue through a target queue processing thread, which has a target distributed lock corresponding to the target queue.
  7. 根据权利要求6所述的方法,其中,队列处理线程的数量大于队列的数量;The method of claim 6, wherein the number of queue processing threads is greater than the number of queues;
    所述通过目标队列处理线程,从所述目标队列中获取n条所述候选任务,包括:The target queue processing thread obtains n candidate tasks from the target queue, including:
    在所述目标队列处理线程抢占到所述目标队列对应的所述目标分布式锁的情况下,通过所述目标队列处理线程,从所述目标队列中获取n条所述候选任务;When the target queue processing thread preempts the target distributed lock corresponding to the target queue, obtain n candidate tasks from the target queue through the target queue processing thread;
    所述方法还包括:The method also includes:
    在所述目标队列处理线程未抢占到分布式锁的情况下,控制所述目标队列处理线程进入休眠状态,所述休眠状态的持续时长为第一时长;When the target queue processing thread does not seize the distributed lock, control the target queue processing thread to enter a sleep state, and the duration of the sleep state is the first time length;
    在达到所述第一时长的情况下,唤醒所述目标队列处理线程,其中,唤醒后的所述目标队列处理线程继续抢占分布式锁。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. 根据权利要求7所述的方法,其中,The method of claim 7, wherein
    在所述目标队列处理线程抢占到所述目标队列对应的所述目标分布式锁的情况下,所述目标队列处理线程每隔第二时长对进行续锁操作;When the target queue processing thread preempts the target distributed lock corresponding to the target queue, the target queue processing thread performs a lock renewal operation on the pair every second period of time;
    在所述目标队列处理线程存在异常的情况下,所述目标分布式锁被释放。When an exception occurs in the target queue processing thread, the target distributed lock is released.
  9. 根据权利要求1至3任一所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further includes:
    响应于第一发布内容对应的内容发布指令,为所述第一发布内容生成第一机器人候选集,所述第一机器人候选集中包含用于对所述第一发布内容执行操作的机器人;In response to a content publishing instruction corresponding to the first published content, generate a first robot candidate set for the first published content, where the first robot candidate set includes robots for performing operations on the first published content;
    基于所述第一发布内容以及所述第一发布内容对应的时间梯度信息,生成所述第一发布内容对应的第一任务;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;
    基于负载均衡策略将所述第一任务添加至队列中。The first task is added to the queue based on a load balancing policy.
  10. 根据权利要求1至3任一所述的方法,其中,所述方法还包括:The method according to any one of claims 1 to 3, wherein the method further includes:
    响应于第二发布内容对应的内容删除指令,删除所述第二发布内容与第二机器人候选集的对应关系;In response to the content deletion instruction corresponding to the second published content, delete the corresponding relationship between the second published content and the second robot candidate set;
    从队列中删除所述第二发布内容对应的第二任务。Delete the second task corresponding to the second published content from the queue.
  11. 根据权利要求1至3任一所述的方法,其中,The method according to any one of claims 1 to 3, wherein,
    发布内容与对应的机器人候选集采用key-value形式存储在redis缓存中,其中,key为发布内容的内容标识,value为所述机器人候选集中各个机器人的机 器人标识;The published content and the corresponding robot candidate set are stored in the redis cache in the form of key-value, where the key is the content identifier of the published content, and the value is the machine of each robot in the robot candidate set. Robot identification;
    任务以score-member形式存储在zset队列中,其中,score为机器人对发布内容执行操作的时间点,member为发布内容的内容标识。Tasks are stored in the zset queue in the form of score-member, where score is the time point when the robot performs operations on the published content, and member is the content identifier of the published content.
  12. 一种内容操作装置,其中,所述装置包括:A content operation device, wherein the device includes:
    获取模块,配置为从目标队列中获取n条候选任务,所述候选任务用于指示机器人在候选时间点对候选发布内容执行操作,n为正整数;The acquisition module is configured to acquire n candidate tasks from the target queue. The candidate tasks are used to instruct the robot to perform operations on the candidate release content at the candidate time point, and n is a positive integer;
    第一确定模块,配置为确定n条所述候选任务中的目标任务,所述目标任务所指示的目标时间点不晚于当前时间点;The first determination module is configured to determine 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;
    第二确定模块,配置为从所述目标任务所指示目标发布内容对应的目标机器人候选集中确定目标机器人,所述目标机器人候选集中包含用于对所述目标发布内容执行操作的机器人;The second determination module is configured to determine the target robot from the 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 the target published content;
    执行操作模块,配置为通过所述目标机器人对所述目标发布内容执行操作。An execution operation module is configured to perform an operation on the target published content through the target robot.
  13. 一种服务器,其中,所述服务器包括处理器和存储器;所述存储器中存储有至少一段程序,所述至少一段程序由所述处理器加载并执行以实现如权利要求1至11任一所述的内容操作方法。A server, wherein the server includes a processor and a memory; at least one program is stored in the memory, and the at least one program is loaded and executed by the processor to implement any one of claims 1 to 11 Content operation method.
  14. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有至少一段程序,所述至少一段程序用于被处理器执行以实现如权利要求1至11任一所述的内容操作方法。A computer-readable storage medium, wherein 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 as described in any one of claims 1 to 11 .
  15. 一种计算机程序产品,其中,所述计算机程序产品包括计算机指令,所述计算机指令存储在计算机可读存储介质中;计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得所述计算机设备实现如权利要求1至11任一所述的内容操作方法。 A computer program product, wherein the computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium; a processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes The computer instructions enable the computer device to implement the content operation method as described in any one of claims 1 to 11.
PCT/CN2023/085155 2022-04-08 2023-03-30 Content operation method and apparatus, and server and storage medium WO2023193653A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210368042.5A CN114820218A (en) 2022-04-08 2022-04-08 Content operation method, device, server and storage medium
CN202210368042.5 2022-04-08

Publications (1)

Publication Number Publication Date
WO2023193653A1 true WO2023193653A1 (en) 2023-10-12

Family

ID=82535470

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/085155 WO2023193653A1 (en) 2022-04-08 2023-03-30 Content operation method and apparatus, and server and storage medium

Country Status (2)

Country Link
CN (1) CN114820218A (en)
WO (1) WO2023193653A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114820218A (en) * 2022-04-08 2022-07-29 百果园技术(新加坡)有限公司 Content operation method, device, server and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111651436A (en) * 2020-04-14 2020-09-11 海南车智易通信息技术有限公司 Processing method and system for user generated content and computing equipment
US20200351527A1 (en) * 2017-03-31 2020-11-05 Dwango Co., Ltd. Virtual processing server, control method of virtual processing server, content distribution system, and application program for terminal device
CN114169803A (en) * 2021-12-31 2022-03-11 深圳市普渡科技有限公司 Robot scheduling method, device, equipment and storage medium
CN114820218A (en) * 2022-04-08 2022-07-29 百果园技术(新加坡)有限公司 Content operation method, device, server and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200351527A1 (en) * 2017-03-31 2020-11-05 Dwango Co., Ltd. Virtual processing server, control method of virtual processing server, content distribution system, and application program for terminal device
CN111651436A (en) * 2020-04-14 2020-09-11 海南车智易通信息技术有限公司 Processing method and system for user generated content and computing equipment
CN114169803A (en) * 2021-12-31 2022-03-11 深圳市普渡科技有限公司 Robot scheduling method, device, equipment and storage medium
CN114820218A (en) * 2022-04-08 2022-07-29 百果园技术(新加坡)有限公司 Content operation method, device, server and storage medium

Also Published As

Publication number Publication date
CN114820218A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
JP6893284B2 (en) Resource scheduling methods, scheduling servers, cloud computing systems, and storage media
Gu et al. Liquid: Intelligent resource estimation and network-efficient scheduling for deep learning jobs on distributed GPU clusters
Li et al. Scaling distributed machine learning with the parameter server
He et al. Matchmaking: A new mapreduce scheduling technique
US20170339238A1 (en) Large message support for a publish-subscribe messaging system
US10296389B2 (en) Time-bound conditional resource deallocation
WO2023193653A1 (en) Content operation method and apparatus, and server and storage medium
CN110569252B (en) Data processing system and method
US9424212B2 (en) Operating system-managed interrupt steering in multiprocessor systems
Pakize A comprehensive view of Hadoop MapReduce scheduling algorithms
US20150120674A1 (en) Virtual program installation and state restoration
US20210103475A1 (en) Cooperation-based node management protocol
CN115658272B (en) ETL task scheduling method, storage medium and electronic equipment
Yi et al. Towards real-time, volunteer distributed computing
Hussain et al. A counter based approach for reducer placement with augmented Hadoop rackawareness
CN112181661B (en) Task scheduling method
Naik et al. A review of adaptive approaches to MapReduce scheduling in heterogeneous environments
Quiané-Ruiz et al. RAFT at work: speeding-up mapreduce applications under task and node failures
CN106371919B (en) It is a kind of based on mapping-reduction computation model data cache method of shuffling
Sai et al. Producer-Consumer problem using Thread pool
CN110502337B (en) Optimization system for shuffling stage in Hadoop MapReduce
CN112445614A (en) Thread data storage management method, computer equipment and storage medium
US10592473B2 (en) Method for improving energy efficiency of map-reduce system and apparatus thereof
US10990385B1 (en) Streaming configuration management
CN111190704A (en) Task classification processing method based on big data processing framework

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23784217

Country of ref document: EP

Kind code of ref document: A1