A method, device, electronic device and readable storage medium for obtaining task information
By controlling the device to obtain and store the identification information of task information when receiving a request, the problem of multiple clients repeatedly obtaining the same task information is avoided, and the processing efficiency and resource utilization of task information are improved.
Patent Information
- Application Number
- CN202211572977.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-12-08
AI Technical Summary
When multiple clients send data acquisition requests to the preset database, task information may be repeatedly obtained, resulting in resource waste and low processing efficiency.
By controlling the communication between the device, the client and the preset database, request information is received, identification information is obtained, and task information is stored and obtained without identification information to avoid repeated acquisition and processing.
It effectively avoids repeated acquisition and processing of task information, improves resource utilization and processing efficiency, and ensures that task information can be efficiently allocated and processed.
Smart Images

Figure 00000000_0000
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a task information acquisition method, device, electronic device and readable storage medium. Background Art
[0002] At present, with the development of information technology, the amount of task information and the number of clients for processing task information are increasing. When multiple clients send data acquisition requests to a preset database, multiple data acquisition requests may be used to request the same task information.
[0003] At this time, the same task information will be obtained by two or more clients, which results in repeated acquisition of task information and waste of resources. Summary of the invention
[0004] The purpose of the embodiments of the present invention is to provide a method, device, electronic device and readable storage medium for obtaining task information, which can avoid repeated acquisition of task information. The specific technical solution is as follows:
[0005] In a first aspect of the present invention, a method for obtaining task information is first provided, which is applied to a control device, wherein the control device communicates with a first client and a preset database respectively, and comprises:
[0006] receiving first request information sent by a first client, where the first request information is used to obtain first task information, and the first request information includes a query condition for the first task information;
[0007] In response to the first request information, obtaining first identification information from a preset database, where the first identification information is used to identify first task information that meets the query condition;
[0008] In a case where the control device does not include the first identification information, storing the first identification information, and acquiring the first task information from a preset database;
[0009] The first task information is sent to the first client.
[0010] In a second aspect of the present invention, there is also provided a task information acquisition device, which is applied to a control device, and the control device communicates with a first client and a preset database respectively, including:
[0011] A receiving module, configured to receive first request information sent by a first client, wherein the first request information is used to obtain first task information, and the first request information includes a query condition for the first task information;
[0012] An acquisition module, configured to acquire first identification information from a preset database in response to the first request information, where the first identification information is used to identify first task information that meets the query condition;
[0013] A storage module, used for storing the first identification information and acquiring the first task information from a preset database when the control device does not include the first identification information;
[0014] The sending module is used to send the first task information to the first client.
[0015] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer executes any of the above-mentioned task information acquisition methods.
[0016] In another aspect of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned task information acquisition methods.
[0017] The task information acquisition method provided by the embodiment of the present invention receives a first request information for acquiring the first task information sent by the first client, the first request information includes the query condition of the first task information; in response to the first request information, acquires the first identification information for identifying the first task information that meets the query condition from the preset database; in the case where the first identification information is not included in the control device, the first identification information is stored and the first task information is acquired from the preset database, which means that at most one first identification information can be stored in the control device, that is, if the first identification information and the first task information have been acquired by other clients, the control device will include the first identification information; correspondingly, if the first identification information and the first task information have not been acquired by other clients, the control device does not include the first identification information. Therefore, in the case where the control device does not include the first identification information, it means that the first task information has not been acquired by other clients. At this time, the first identification information can be stored and the first task information can be acquired from the preset database, which can avoid the situation where the first task information is acquired by the first client again when it has been acquired by other clients, that is, it can avoid the first identification information being repeatedly acquired by two or more clients and the first task information can be repeatedly processed by two or more clients, thereby avoiding resource waste. Finally, the first task information is sent to the first client so that the first client processes the first task information. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0019] Figure 1 It is a schematic diagram of an application environment of a method for obtaining task information provided by an embodiment of the present invention;
[0020] Figure 2 is a flow chart of a method for obtaining task information provided by an embodiment of the present invention;
[0021] Figure 3 is a flow chart of a method for acquiring task information provided by an embodiment of the present invention;
[0022] Figure 4 It is a structural schematic diagram of a task information acquisition device provided by an embodiment of the present invention;
[0023] Figure 5 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0025] The task information acquisition method provided by the embodiment of the present invention can be applied to at least the following application scenarios, which are described below.
[0026] At present, taking the case of staff reviewing videos as an example, there are multiple clients corresponding to the staff and multiple videos to be reviewed. When multiple clients send data acquisition requests to obtain the videos to be reviewed, since one of the clients does not know what task information other clients are going to obtain, multiple data acquisition requests will be used to request the same task information (i.e., the videos to be reviewed), which is prone to the following problems:
[0027] First, there is the problem of repeated collection, that is, two or more clients obtain the same task information, and the task information is obtained repeatedly, resulting in a waste of resources; second, there is the problem of slow collection speed, that is, two or more clients obtain the same task information. If the task information can only be processed by one client, it is impossible to determine which client the task information should be assigned to, so the task information cannot be sent to the client, resulting in the task information cannot be processed; then, the number of task information received by the client is less than the number of tasks requested by the client, that is, the client's processing resources cannot be fully utilized, resulting in a waste of resources.
[0028] Based on the above application scenario, the task information acquisition method provided by the embodiment of the present invention is described in detail below.
[0029] like Figure 1As shown, the control device communicates with the first client and the preset database respectively, and the control device is responsible for information transmission between the first client and the preset database.
[0030] First, the first client sends a first request message, where the first request message is used to obtain first task information, and the first request message includes a query condition for the first task information.
[0031] Then, the control device receives the first request information sent by the first client, and in response to the first request information, the control device obtains first identification information from a preset database, where the first identification information is used to identify the first task information that meets the query condition.
[0032] Next, in a case where the control device does not include the first identification information, the first identification information is stored and the first task information is acquired from a preset database.
[0033] When the first identification information is not included in the control device, the first identification information is stored, which means that at most one first identification information can be stored in the control device. That is to say, if the first identification information and the first task information have been acquired by other clients, the first identification information will be included in the control device, and the control device will no longer be able to repeatedly store the first identification information; correspondingly, if the first identification information and the first task information have not been acquired by other clients, the first identification information is not included in the control device, and the control device can store the first identification information at this time.
[0034] Therefore, when the control device does not include the first identification information, it means that the first task information has not been obtained by other clients. At this time, the first identification information can be stored and the first task information can be obtained from the preset database, which can avoid the situation where the first task information is obtained by the first client again when it has been obtained by other clients, that is, it can avoid the first identification information being repeatedly obtained by two or more clients and the first task information can be avoided from being repeatedly processed by two or more clients. Finally, the control device sends the first task information to the first client so that the client can efficiently process the first task information.
[0035] Figure 2 is a flow chart of a method for obtaining task information provided by an embodiment of the present invention;
[0036] like Figure 2 As shown, the task information acquisition method may include steps 210 to 240, which are specifically as follows:
[0037] Step 210, receiving first request information sent by a first client, where the first request information is used to obtain first task information, and the first request information includes a query condition for the first task information;
[0038] Step 220, in response to the first request information, obtaining first identification information from a preset database, where the first identification information is used to identify first task information that meets the query condition;
[0039] Step 230: if the control device does not include the first identification information, store the first identification information, and obtain the first task information from a preset database;
[0040] Step 240: Send the first task information to the first client.
[0041] In an embodiment of the present invention, a first request message for obtaining first task information sent by a first client is received, and the first request message includes a query condition for the first task information; in response to the first request message, first identification information for identifying the first task information that meets the query condition is obtained from a preset database; in the case where the first identification information is not included in the control device, the first identification information is stored and the first task information is obtained from the preset database, which means that at most one first identification information can be stored in the control device, that is, if the first identification information and the first task information have been obtained by other clients, the control device will include the first identification information; correspondingly, if the first identification information and the first task information have not been obtained by other clients, the control device does not include the first identification information. Therefore, in the case where the control device does not include the first identification information, it means that the first task information has not been obtained by other clients. At this time, the first identification information can be stored and the first task information can be obtained from the preset database, which can avoid the situation where the first task information is obtained by the first client again when it has been obtained by other clients, that is, it can avoid the first identification information being repeatedly obtained by two or more clients and the first task information can be repeatedly processed by two or more clients. Finally, the first task information is sent to the first client so that the first client processes the first task information.
[0042] The specific implementation methods of the above steps are introduced below.
[0043] This involves step 210 .
[0044] A first request message sent by a first client is received, where the first request message is used to obtain first task information, and the first request message includes a query condition for the first task information.
[0045] This involves step 220 .
[0046] In response to the first request information, first identification information is acquired from a preset database, where the first identification information is used to identify first task information that meets the query condition.
[0047] The query conditions may include: task information publisher, task information keywords and tags.
[0048] For example, the query condition included in the first request information is: if the video publisher is "Xiao A", the first task information of the video publisher "Xiao A" is queried from the preset database, and then the first identification information is obtained from the preset database.
[0049] In a possible embodiment, the preset database includes: task information corresponding to preset tags respectively, the first request information includes the first tag corresponding to the client, and step 220 includes:
[0050] In response to the first request information, determining a second tag corresponding to the first task information from preset tags;
[0051] When the first tag and the second tag match, first identification information is obtained from a preset database; wherein the first tag is used to mark the category of the task information processed by the first client, and the second tag is used to mark the category of the first task information.
[0052] Currently, when two or more clients obtain the same task information, if the task information can only be processed by one client, it is impossible to determine which client the task information should be assigned to, so the task information cannot be sent to the client, resulting in the task information being unable to be processed, affecting the processing efficiency of the task information.
[0053] In order to improve the processing efficiency of task information, the task information in the preset database can be divided according to preset tags to obtain task information corresponding to the preset tags, that is, the preset database includes: task information corresponding to the preset tags.
[0054] Among them, the first label is used to mark the category of task information processed by the first client. If the first label is "short video", it can indicate that the category of task information processed by the first client is short video; if the first label is "long video", it can indicate that the category of task information processed by the first client is long video.
[0055] The second tag is used to mark the category of the first task information. If the second tag is "short video", it can indicate that the category of the first task information is short video; if the second tag is "long video", it can indicate that the category of the first task information is long video.
[0056] In addition, the first tag can be specifically used to mark the category and keywords of the task information processed by the first client. If the first tag is "food short video", it can indicate that the category of the task information processed by the first client is food short video; that is, the category of the task information is "short video" and the keyword of the task information is "food".
[0057] The second tag can be specifically used to mark the category and keywords of the first task information. If the second tag is "food short video", it can indicate that the category of the first task information is food short video.
[0058] Among them, the first request information includes a first tag corresponding to the client, and the second tag is used to mark the category of task information processed by the first client. Then, the second tag corresponding to the first task information is determined, and then the first tag and the second tag are verified. When the first tag and the second tag match, it means that the first client can obtain the first task information. At this time, the first identification information is obtained from the preset database.
[0059] For example, when the first label and the second label are both "short video", the first label and the second label match, which means that the first client and the first task information match, and the first identification information can be obtained from the preset database;
[0060] When the first label is "short video" and the second label is "long video", the first label and the second label do not match, which means that the first client and the first task information do not match, and the first identification information is refused to be obtained from the preset database.
[0061] Here, by verifying the first tag corresponding to the first client and the second tag corresponding to the first task information, the massive task data can be divided into more detailed categories, which can reduce the probability of two or more clients obtaining the same task information and reduce conflicts in task information collection, thereby increasing the probability of successful task information collection.
[0062] In a possible embodiment, the first request information includes first quantity information, the first quantity information is used to identify a first quantity, the first quantity is greater than a second quantity that the first client needs to obtain task information, and step 220 includes:
[0063] Taking the first quantity as the target query quantity, obtaining second identification information from a preset database, where the second identification information is used to identify second task information that meets the query condition; the second task information is the third quantity;
[0064] When the third number is greater than or equal to the second number, the second number of first identification information is acquired from the second identification information.
[0065] The first request information includes first quantity information, which is used to identify a first quantity. The first quantity is greater than a second quantity that the client needs to obtain task information. For example, the second quantity of task information that the client needs to obtain is 95, and the first quantity identified by the first quantity information included in the first request information is 100. The second identification information actually obtained from the preset database is 98.
[0066] If the number of task information that the first client needs to obtain is taken as the target query number, that is, the second number of task information that the first client needs is 95, but two of the task information that the first client needs to obtain are also requested by other clients at the same time, it is impossible to determine which client these two task information should be assigned to, that is, these two task information cannot be assigned. In other words, the number of task information that the first client can actually obtain is 93, which does not meet the first client's need to obtain task information, and the computing resources of the first client cannot be fully utilized, resulting in a waste of resources; or, it is necessary to request the preset database again to obtain the task information required by the first client, resulting in a waste of resources.
[0067] In an embodiment of the present invention, by taking a first number greater than a second number that the client needs to obtain task information as the target query number, the second identification information is obtained from a preset database, that is, taking 100 as the target query number, even if there are 2 task information that the client involved in the above-mentioned task needs to obtain and are also requested by other clients at the same time, since the second identification information actually obtained from the preset database is 98, the need of the first client to obtain the task information can still be met. Therefore, the problem of failure to obtain the task information caused by the conflict of task information can be compensated to a certain extent, and the probability of failure to obtain the task information can be reduced.
[0068] When the third quantity of the second task information obtained is greater than the second quantity of the task information that the first client needs to obtain, the first quantity of first identification information is randomly obtained from the second identification information, that is, 95 first identification information can be randomly obtained from 98 second identification information. This can avoid repeated execution of the step of obtaining identification information from a preset database due to insufficient second task information obtained, and can obtain the second quantity of task information that the client needs to obtain at one time, saving processing resources.
[0069] After the above-mentioned step of taking the first quantity as the target query quantity and acquiring the second identification information from the preset database, the following steps are also included:
[0070] When the third number is smaller than the second number, the step of acquiring the second identification information from the preset database is repeated until the number of times the second identification information is acquired is greater than the preset number, or until the third number is greater than or equal to the second number.
[0071] When the second identification information actually obtained from the preset database is less than the task information that the client needs to obtain, the collection logic can be executed multiple times by increasing the collection batch, that is, the step of obtaining the second identification information from the preset database is repeated until the number of times the second identification information is obtained is greater than the preset number of times, or until the third number is greater than or equal to the second number. For example, the number of times the second identification information is obtained is 4 times, and the preset number of times is 3 times, that is, if the number of times the second identification information is obtained is greater than the preset number of times, then the step of repeatedly obtaining the second identification information from the preset database can be stopped. Alternatively, if the third number of the second task information obtained is greater than the second number of task information that the first client needs to obtain, then the step of repeatedly obtaining the second identification information from the preset database can be stopped. In this way, the problem of insufficient second identification information being collected can be solved, and then the problem of insufficient task information being collected can be solved.
[0072] This involves step 230 .
[0073] In the case that the control device does not include the first identification information, the first identification information is stored, and the first task information is acquired from a preset database.
[0074] In the case where the control device does not include the first identification information, the first identification information is stored. That is to say, if the control device already includes the first identification information, it means that the first task information has been acquired by other clients, and the control device will not repeatedly store the first identification information and will not acquire the first task information later. On the contrary, if the control device does not include the first identification information, it means that the first task information has not been acquired by other clients, and the first identification information can be stored and the first task information can be acquired from the preset database.
[0075] Specifically, the first identification information can be stored through the "setIfAbsent" operation of the remote field service (Remote DictionaryServer, Redis). The "setIfAbsent" operation is used to indicate that if the key does not exist, a new value will be added, and if the key exists, the existing value will not be changed. If the control device does not include the first identification information, the first identification information is stored (if the key does not exist, a new value will be added), and if the control device includes the first identification information (if the key exists, the existing value will not be changed). Redis supports network, memory-based and persistent log-type, Key-Value databases, and provides application programming interfaces in multiple languages.
[0076] When two or more clients obtain the same task information, it is easy for them to receive the same task information at the same time. At this time, if the first identification information is not included in the control device, the first identification information is stored to solve the problem of repeated acquisition of task information.
[0077] Usually, a distributed database includes a master database and a slave database. The master database can read and write data, while the slave database can usually only read data. If the client has obtained the first task information from the master database, there is a certain delay in the synchronization process between the master database and the slave database, that is, when other clients query the slave database, the data that can be queried from the slave database still includes the first task information. At this time, other clients also initiate a request to obtain the first task information from the slave database. Since the first task information has been obtained from the master database, the problem of duplicate collection will occur.
[0078] In an embodiment of the present invention, if the client has obtained the first task information from the main database through the control device, the control device will include the first identification information. In this way, even if there is a certain delay in the synchronization process between the main database and the slave database, when other clients obtain the first task information from the slave database, since the control device already includes the first identification information, it means that the first identification information has been obtained from the main database. Based on an embodiment of the present invention, when the control device does not include the first identification information, the first identification information can be stored and the first task information can be obtained from the preset database. Since the first identification information is already included in the control device, other clients cannot obtain the first task information from the slave database, so the problem of duplicate collection can be avoided.
[0079] Therefore, when the first identification information meets the preset storage conditions, the first identification information is stored, which can also solve the problem of repeated collection caused by the master-slave synchronization delay of the database.
[0080] In a possible embodiment, after step 230, the following steps may also be included:
[0081] receiving second request information sent by a second client, where the second request information is used to obtain first task information;
[0082] In response to detecting that the control device includes the first identification information, prompt information is sent to the second client, where the prompt information is used to prompt that the first task information has been acquired by the first client.
[0083] In response to detecting that the control device includes the first identification information, it means that the first identification information has been obtained from the preset database, and the first identification information cannot be stored repeatedly in the control device, that is, the second client can no longer obtain the first task information. At this time, a prompt message is sent to the second client, and the prompt message is used to prompt that the first task information has been obtained by the first client.
[0084] Therefore, when the control device includes the first identification information, prompt information is sent to the second client, and the prompt information is used to prompt that the first task information has been obtained, so as to avoid the second client from repeatedly obtaining the first task information.
[0085] In a possible embodiment, after step 230, the following steps are further included:
[0086] Sending first update information to a preset database, the first update information is used to update the information status of the first task information in the preset database to an acquired status, wherein the task information in the acquired status is not used to be acquired by a client, and the client is a client communicating with a control device.
[0087] After storing the first identification information and obtaining the first task information from the preset database, first update information for updating the information status of the first task information in the preset database to the obtained status can be sent to the preset database. After receiving the first update information, the preset database updates the information status of the first task information to the obtained status. Among them, the task information in the obtained status is not used to be obtained by the client, that is, the task information in the obtained status is not within the query range of the client request information. Here, the queryable range of the preset database can be reduced to improve the query efficiency.
[0088] Involving step 240: Sending the first task information to the first client.
[0089] In a possible embodiment, after step 240, the following steps are further included:
[0090] Accumulate the duration from the time when the first client receives the first task information to the current time to obtain a first duration;
[0091] When the first duration is greater than the preset duration, obtaining the information status of the first task information;
[0092] When the information status of the third task information in the first task information is a state not processed by the first client, sending second update information to the preset database, where the second update information is used to update the information status of the third task information in the preset database to a state not obtained;
[0093] The third identification information corresponding to the third task information is deleted.
[0094] The duration from the time when the first client receives the first task information to the current time is accumulated to obtain the first duration; when the first duration is greater than the preset duration, the information status of the first task information can be obtained to confirm whether the first task information is processed by the first client.
[0095] The information status of the first task information can be determined according to the operation information of the first client. If the operation information of the first client on the first task information is detected, it means that the information status of the first task information is a status that has been processed by the first client; if the operation information of the first client on the first task information is not detected, it means that the information status of the first task information is a status that has not been processed by the first client.
[0096] If the information status of the third task information in the first task information is a state that has been processed by the first client, no processing is required. If the information status of the third task information in the first task information is a state that has not been processed by the first client, a second update message is sent to the preset database, and the second update message is used to update the information status of the third task information in the preset database to an unacquired state, wherein the task information in the unacquired state is used to be acquired by the client, here, it can be convenient for other clients to acquire the third task information, and improve the efficiency of task acquisition and processing.
[0097] And, the third identification information corresponding to the third task information is deleted, because of the aforementioned step of storing the first identification information when the first identification information is not included in the control device. Similarly, if the control device already includes the third identification information, it means that the third task information has been obtained by other clients, and the control device will not store the third identification information again, that is, other clients cannot obtain the third task information corresponding to the third identification information through the control device.
[0098] Here, the third identification information corresponding to the third task information is deleted so that the third identification information is not included in the control device. At this time, if other clients request to obtain the third identification information, the control device can store the third identification information, that is, other clients can obtain the third task information corresponding to the third identification information through the control device.
[0099] Thus, the third identification information corresponding to the third task information that has not been processed by the first client for more than a preset period of time can be deleted, so that other clients can obtain the third identification information and the third task information corresponding to the third identification information, thereby improving task acquisition and processing efficiency.
[0100] The preset duration may be determined according to the task type. For example, the preset duration for a long video may be ten minutes, and the preset duration for a short video may be five minutes.
[0101] In summary, by receiving the first request information sent by the first client for obtaining the first task information, the first request information includes the query condition of the first task information; in response to the first request information, the first identification information for identifying the first task information that meets the query condition is obtained from the preset database; in the case where the first identification information is not included in the control device, the first identification information is stored and the first task information is obtained from the preset database, which means that at most one first identification information can be stored in the control device, that is, if the first identification information and the first task information have been obtained by other clients, the control device will include the first identification information; correspondingly, if the first identification information and the first task information have not been obtained by other clients, the control device does not include the first identification information. Therefore, in the case where the control device does not include the first identification information, it means that the first task information has not been obtained by other clients. At this time, the first identification information can be stored and the first task information can be obtained from the preset database, which can avoid the situation where the first task information is obtained by the first client again when it has been obtained by other clients, that is, it can avoid the first identification information being repeatedly obtained by two or more clients and the first task information can be repeatedly processed by two or more clients. Finally, the first task information is sent to the first client so that the first client processes the first task information.
[0102] Figure 3 is a flow chart of a method for acquiring task information provided by an embodiment of the present invention. Figure 3 As shown, the method for implementing task information acquisition may include:
[0103] Step 310: divide the task information in the preset database according to the preset tags to obtain the task information corresponding to the preset tags.
[0104] Specifically, the preset database includes: task information corresponding to the preset tags respectively.
[0105] Step 320: Receive first request information sent by the first client, where the first request information is used to obtain first task information and includes a query condition for the first task information.
[0106] Specifically, the query conditions may include: task information publisher, task information keywords and tags.
[0107] Step 330, in response to the first request information, determine a second tag corresponding to the first task information from the preset tags; when the first tag and the second tag match, obtain a query quantity with the first quantity as the target from the preset database, and obtain second identification information from the preset database, the second identification information is used to identify the second task information that meets the query condition; the first quantity is greater than the second quantity of task information that the client needs to obtain; wherein the first tag is used to mark the category of task information processed by the first client, and the second tag is used to mark the category of the first task information.
[0108] Specifically, the first tag and the second tag are checked. For example, the first tag can be used to mark the category and keywords of the task information processed by the first client. If the first tag is "food short video", it can indicate that the category of the task information processed by the first client is food short video. The second tag can be used to mark the category and keywords of the first task information. If the second tag is "food short video", it can indicate that the category of the first task information is food short video.
[0109] When the first tag and the second tag match, the first quantity is obtained from the preset database as the target query quantity, and the second identification information is obtained from the preset database. The first quantity is greater than the second quantity that the client needs to obtain task information, for example, the first quantity is 1.5 times the second quantity.
[0110] Step 340: If the control device does not include the second identification information, store the second identification information.
[0111] Specifically, if the control device does not include the second identification information, the second identification information is stored. That is to say, if the control device already includes the second identification information, it means that the second task information has been acquired by other clients, and the control device will not repeatedly store the second identification information and will not acquire the second task information later. On the contrary, if the control device does not include the second identification information, it means that the second task information has not been acquired by other clients, and the second identification information can be stored and the second task information can be acquired from the preset database.
[0112] When two or more clients obtain the same task information, it is easy for them to receive the same task information at the same time. At this time, if the second identification information is not included in the control device, the second identification information is stored to solve the problem of repeated acquisition of task information.
[0113] Step 350 , counting a third amount of the second task information, and determining whether the third amount is greater than or equal to the second amount. If yes, executing step 360 ; if no, executing step 370 .
[0114] Specifically, when the third number is greater than or equal to the second number, obtaining the second number of first identification information from the second identification information;
[0115] When the third number is smaller than the second number, the step of acquiring the second identification information from the preset database is repeatedly performed, and the number of times the second identification information is acquired is accumulated.
[0116] Step 360: Obtain a second quantity of first identification information from the second identification information.
[0117] Specifically, when the third quantity of the second task information obtained is greater than the second quantity of the task information that the first client needs to obtain, the first quantity of the first identification information is randomly obtained from the second identification information. This can avoid the step of repeatedly executing the step of obtaining the identification information from the preset database due to insufficient second task information obtained, and can obtain the second quantity of the task information that the client needs to obtain at one time, saving processing resources.
[0118] Step 370 , accumulating the number of times the second identification information is obtained, and determining whether the number of times the second identification information is obtained is greater than a preset number. If yes, executing step 380 ; otherwise, returning to step 330 .
[0119] Specifically, the number of times the second identification information is obtained is 4 times, and the preset number is 3 times, that is, the number of times the second identification information is obtained is greater than the preset number, then the step of repeatedly obtaining the second identification information from the preset database can be stopped, and the subsequent step of sending the first update information to the preset database can be executed.
[0120] If the number of times the second identification information is obtained is not greater than the preset number, the step of obtaining the second identification information from the preset database may continue to be performed.
[0121] Step 380, sending first update information to the preset database, the first update information is used to update the information status of the first task information in the preset database to an acquired status, wherein the task information in the acquired status is not used to be acquired by the client, and the client is a client communicating with the control device.
[0122] Specifically, after receiving the first update information, the preset database updates the information status of the first task information to the acquired status. Among them, the task information in the acquired status is not used to be acquired by the client, that is, the task information in the acquired status is not within the query range of the client request information. Here, the queryable range of the preset database can be reduced to improve the query efficiency.
[0123] Step 390: Obtain first task information from a preset database.
[0124] After the first task information is acquired from the preset database, the first task information may be sent to the first client.
[0125] Based on the above Figure 2 The task information acquisition method shown in the embodiment of the present invention also provides a task information acquisition device, such as Figure 4 As shown, the task information acquisition device 400 may include:
[0126] The receiving module 410 is used to receive first request information sent by the first client, where the first request information is used to obtain first task information, and the first request information includes a query condition for the first task information;
[0127] An acquisition module 420 is used to acquire first identification information from a preset database in response to the first request information, where the first identification information is used to identify first task information that meets the query condition;
[0128] The storage module 430 is used to store the first identification information and obtain the first task information from a preset database when the control device does not include the first identification information;
[0129] The sending module 440 is configured to send the first task information to the first client.
[0130] In a possible embodiment, the preset database includes: task information corresponding to preset tags respectively, the first request information includes the first tag corresponding to the first client, and the acquisition module 420 is specifically used to:
[0131] In response to the first request information, determining a second tag corresponding to the first task information from preset tags;
[0132] When the first tag and the second tag match, first identification information is obtained from a preset database; wherein the first tag is used to mark the category of the task information processed by the first client, and the second tag is used to mark the category of the first task information.
[0133] In a possible embodiment, the task information acquisition device 400 may further include:
[0134] A first receiving module is used to receive second request information sent by a second client, where the second request information is used to obtain first task information;
[0135] The first sending module is used to send prompt information to the second client in response to detecting that the control device includes the first identification information, where the prompt information is used to prompt that the first task information has been acquired by the first client.
[0136] In a possible embodiment, the first request information includes first quantity information, the first quantity information is used to identify a first quantity, the first quantity is greater than a second quantity of task information that the first client needs to obtain, and the obtaining module 420 is specifically used to:
[0137] Taking the first quantity as the target query quantity, obtaining second identification information from a preset database, where the second identification information is used to identify second task information that meets the query condition; the second task information is the third quantity;
[0138] When the third number is greater than or equal to the second number, the second number of first identification information is acquired from the second identification information.
[0139] In a possible embodiment, the task information acquisition device 400 may further include:
[0140] A repetition module is used to repeatedly execute the step of obtaining the second identification information from the preset database when the third number is less than the second number, until the number of times the second identification information is obtained is greater than the preset number, or until the third number is greater than or equal to the second number.
[0141] In a possible embodiment, the task information acquisition device 400 may further include:
[0142] The second sending module is used to send first update information to a preset database, and the first update information is used to update the information status of the first task information in the preset database to an acquired status, wherein the task information in the acquired status is not used to be acquired by the client, and the client is a client that communicates with the control device.
[0143] In a possible embodiment, the task information acquisition device 400 may further include:
[0144] An accumulation module, used for accumulating the duration from the moment when the first client receives the first task information to the current moment, to obtain a first duration;
[0145] A first acquisition module, used for acquiring the information status of the first task information when the first duration is greater than a preset duration;
[0146] A third sending module is used to send second update information to the preset database when the information status of the third task information in the first task information is a state not processed by the first client, and the second update information is used to update the information status of the third task information in the preset database to a state not obtained;
[0147] The deleting module is used to delete the third identification information corresponding to the third task information.
[0148] In summary, in an embodiment of the present invention, by receiving a first request information sent by a first client for obtaining first task information, the first request information includes a query condition for the first task information; in response to the first request information, first identification information for identifying the first task information that meets the query condition is obtained from a preset database; in the case where the first identification information is not included in the control device, the first identification information is stored and the first task information is obtained from the preset database, which means that at most one first identification information can be stored in the control device, that is, if the first identification information and the first task information have been obtained by other clients, the control device will include the first identification information; correspondingly, if the first identification information and the first task information have not been obtained by other clients, the control device does not include the first identification information. Therefore, in the case where the control device does not include the first identification information, it means that the first task information has not been obtained by other clients. At this time, the first identification information can be stored and the first task information can be obtained from the preset database, which can avoid the situation where the first task information is obtained by the first client again when it has been obtained by other clients, that is, it can avoid the first identification information being repeatedly obtained by two or more clients and the first task information can be repeatedly processed by two or more clients. Finally, the first task information is sent to the first client so that the first client processes the first task information.
[0149] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0150] Memory 503, used for storing computer programs;
[0151] The processor 501 is used to execute the program stored in the memory 503, and implements the following steps:
[0152] Receive a first request message sent by a first client, the first request message is used to obtain first task information, and the first request message includes a query condition for the first task information; in response to the first request message, obtain first identification information from a preset database, the first identification information is used to identify the first task information that meets the query condition; if the first identification information is not included in the control device, store the first identification information, and obtain the first task information from the preset database; send the first task information to the first client. According to an embodiment of the present invention, the efficiency of obtaining task information can be improved.
[0153] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0154] The communication interface is used for communication between the above terminal and other devices.
[0155] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0156] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0157] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the task information acquisition method described in any of the above embodiments.
[0158] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is executed on a computer, the computer executes the task information acquisition method described in any one of the above embodiments.
[0159] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0160] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0161] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0162] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for obtaining task information, characterized in that: Applied to a control device, the control device communicates with a first client and a preset database respectively, the method comprising: Receive first request information sent by the first client, the first request information is used to obtain first task information, the first request information includes a query condition for the first task information, the first request information includes first quantity information, the first quantity information is used to identify a first quantity, and the first quantity is greater than a second quantity that the first client needs to obtain task information; In response to the first request information, obtaining first identification information from the preset database, where the first identification information is used to identify first task information that meets the query condition; In a case where the control device does not include the first identification information, storing the first identification information, and acquiring the first task information from the preset database; Sending the first task information to the first client; The acquiring the first identification information from the preset database in response to the first request information includes: Taking the first quantity as the target query quantity, obtaining second identification information from the preset database, where the second identification information is used to identify second task information that meets the query condition; the second task information is a third quantity; When the third number is greater than or equal to the second number, the second number of the first identification information is acquired from the second identification information.
2. The method according to claim 1, characterized in that The preset database includes: task information corresponding to preset tags respectively, the first request information includes a first tag corresponding to the first client, and the first identification information is obtained from the preset database in response to the first request information, including: In response to the first request information, determining a second tag corresponding to the first task information from the preset tags; When the first tag and the second tag match, the first identification information is obtained from the preset database; wherein the first tag is used to mark the category of the task information processed by the first client, and the second tag is used to mark the category of the first task information.
3. The method according to claim 1, characterized in that In the case that the control device does not include the first identification information, after storing the first identification information and acquiring the first task information from the preset database, the method further includes: receiving second request information sent by a second client, where the second request information is used to obtain the first task information; In response to detecting that the control device includes the first identification information, prompt information is sent to the second client, where the prompt information is used to prompt that the first task information has been acquired by the first client.
4. The method according to claim 1, characterized in that: After taking the first quantity as the target query quantity and acquiring second identification information from the preset database, the method further includes: When the third number is smaller than the second number, the step of obtaining the second identification information from the preset database is repeated until the number of times the second identification information is obtained is greater than a preset number, or until the third number is greater than or equal to the second number.
5. The method according to claim 1, characterized in that In the case that the control device does not include the first identification information, after storing the first identification information and acquiring the first task information from the preset database, the method further includes: Sending first update information to the preset database, wherein the first update information is used to update the information status of the first task information in the preset database to an acquired status, wherein the task information in the acquired status is not used to be acquired by a client, and the client is a client communicating with the control device.
6. The method according to claim 5, characterized in that After sending the first task information to the first client, the method further includes: Accumulating the duration from the time when the first client receives the first task information to the current time to obtain a first duration; When the first duration is greater than a preset duration, obtaining the information status of the first task information; When the information status of the third task information in the first task information is a state not processed by the first client, sending second update information to the preset database, wherein the second update information is used to update the information status of the third task information in the preset database to a state not obtained; The third identification information corresponding to the third task information is deleted.
7. A task information acquisition device, characterized in that: Applied to a control device, the control device communicates with a first client and a preset database respectively, the device comprises: A receiving module, configured to receive first request information sent by the first client, the first request information being used to obtain first task information, the first request information including a query condition for the first task information, the first request information including first quantity information, the first quantity information being used to identify a first quantity, the first quantity being greater than a second quantity that the first client needs to obtain task information; an acquisition module, configured to acquire first identification information from the preset database in response to the first request information, wherein the first identification information is used to identify first task information that meets the query condition; a storage module, configured to store the first identification information and obtain the first task information from the preset database when the first identification information is not included in the control device; A sending module, used for sending the first task information to the first client; The acquisition module is specifically used to acquire second identification information from the preset database with the first quantity as the target query quantity, the second identification information being used to identify second task information that meets the query condition; the second task information is a third quantity; when the third quantity is greater than or equal to the second quantity, the first identification information of the second quantity is acquired from the second identification information.
8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
