CN114007111A - Resource distribution method and device, electronic equipment and storage medium - Google Patents

Resource distribution method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114007111A
CN114007111A CN202111263434.7A CN202111263434A CN114007111A CN 114007111 A CN114007111 A CN 114007111A CN 202111263434 A CN202111263434 A CN 202111263434A CN 114007111 A CN114007111 A CN 114007111A
Authority
CN
China
Prior art keywords
user account
message queue
resource distribution
resource
target user
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202111263434.7A
Other languages
Chinese (zh)
Other versions
CN114007111B (en
Inventor
于欣洋
谭培强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202111263434.7A priority Critical patent/CN114007111B/en
Publication of CN114007111A publication Critical patent/CN114007111A/en
Application granted granted Critical
Publication of CN114007111B publication Critical patent/CN114007111B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/258Client or end-user data management, e.g. managing client capabilities, user preferences or demographics, processing of multiple end-users preferences to derive collaborative data
    • H04N21/25866Management of end-user data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • 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
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0213Consumer transaction fees
    • 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
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0224Discounts or incentives, e.g. coupons or rebates based on user history
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/258Client or end-user data management, e.g. managing client capabilities, user preferences or demographics, processing of multiple end-users preferences to derive collaborative data
    • H04N21/25866Management of end-user data
    • H04N21/25891Management of end-user data being end-user preferences
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4784Supplemental services, e.g. displaying phone caller identification, shopping application receiving rewards

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • Signal Processing (AREA)
  • Finance (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Graphics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The disclosure relates to a resource distribution method, a resource distribution device, an electronic device and a storage medium. The method comprises the following steps: determining a user account meeting the resource distribution requirement; storing the user account to a first message queue, and distributing resources to the user account in the first message queue; and when the user account with the resource distribution failure exists in the first message queue, the user account with the resource distribution failure is used as a first target user account, the first target user account is stored in the second message queue, and the resource is distributed to the first target user account in the second message queue. According to the scheme disclosed by the invention, the user account is stored in the first message queue, so that the resources can be distributed in real time under the condition of high concurrency, and the resource distribution efficiency is ensured; the first target user account with the resource distribution failure is stored in the second message queue, so that the resource distribution omission of part of user accounts caused by network jitter, equipment failure and the like can be avoided, and the accurate resource distribution is ensured.

Description

Resource distribution method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a resource distribution method, apparatus, electronic device, computer-readable storage medium, and computer program product.
Background
Many current application platforms (e.g., live broadcast platforms) are used to perform holiday activities, drainage activities, and the like. The account level of the user account is determined in real time according to the using condition (such as consumption, task completion and the like) of the user account in the activity process, and the upgrade reward resources are distributed to the user account when the user account is determined to meet the upgrade requirement.
In the related art, the user accounts meeting the upgrade requirement can be asynchronously stored in the database based on the asynchronous link technology. Then, user accounts stored in a preset time length from the current time are obtained from the database at regular time, and resources are distributed to the user accounts in a limited time length. However, because the above activities often have the situations of ultra-large flow and concurrency, the phenomenon of timeout caused by too many user accounts needing to be processed and incomplete distribution within a limited time is easily caused, so that the problem that the reward resources of some user accounts are missed is caused.
Disclosure of Invention
The present disclosure provides a resource distribution method, apparatus, electronic device, computer-readable storage medium, and computer program product to solve at least the problem of missed distribution of bonus resources for some user accounts in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a resource distribution method, including:
determining a user account meeting the resource distribution requirement;
storing the user account to a first message queue, and distributing resources to the user account in the first message queue;
when the user account with the resource distribution failure exists in the first message queue, the user account with the resource distribution failure is used as a first target user account, the first target user account is stored in a second message queue, and the resource is distributed to the first target user account in the second message queue.
In one embodiment, the method further comprises:
when the user account is read from the first message queue and resources are distributed to the user account, the read user account and the resource distribution state corresponding to the read user account are stored in a database;
and acquiring a second target user account with the resource distribution state of non-distribution from the database every a first time length, and distributing the resource to the second target user account.
In one embodiment, the taking the user account with the failed resource distribution as a first target user account when the user account with the failed resource distribution exists in the first message queue includes:
and when the user account which fails to be read exists in the first message queue and/or the user account which fails to be stored in the database exists in the read user accounts, taking the user account which fails to be read and the user account which fails to be stored as the first target user account which fails in resource distribution.
In one embodiment, the storing the first target user account to a second message queue, and distributing the resource to the first target user account in the second message queue includes:
storing the first target user account to the second message queue, the second message queue being used to store the first target user account for a resource distribution service, the resource distribution service being used to distribute resources to the first target user account.
In one embodiment, the storing the user account to a first message queue, and distributing the resource to the user account in the first message queue, includes:
and storing the user account to the first message queue, wherein the first message queue is used for storing the user account for the resource distribution service, and the resource distribution service is used for reading the user account from the first message queue and distributing the resource to the read user account.
In one embodiment, the method further comprises:
when the user account is failed to be stored in the first message queue, determining a storage failure reason;
when the storage failure reason is that a first server where the first message queue is located has a fault, determining a second server where a third message queue is deployed, and storing the user account into the third message queue;
the distributing resources to the user account in the first message queue includes:
distributing resources to the user accounts in the third message queue.
In one embodiment, the method further comprises:
and when the resource is failed to be distributed to the first target user account in the second message queue, distributing the resource to the first target user account with the failed resource distribution every second time period until the resource distribution is successful.
According to a second aspect of the embodiments of the present disclosure, there is provided a resource distribution apparatus including:
an account determination module configured to perform determining user accounts that meet resource distribution requirements;
a first distribution module configured to perform storing the user account to a first message queue, distributing resources to the user account in the first message queue;
and the second distribution module is configured to execute the steps that when the user account with the resource distribution failure exists in the first message queue, the user account with the resource distribution failure is used as a first target user account, the first target user account is stored in a second message queue, and the resource is distributed to the first target user account in the second message queue.
In one embodiment, the apparatus further comprises:
the first storage module is configured to store the read user account and the read resource distribution state corresponding to the user account into a database when the user account is read from the first message queue and resources are distributed to the user account;
and the third distribution module is configured to acquire a second target user account with the resource distribution state of being undistributed from the database every first time length and distribute the resource to the second target user account.
In one embodiment, the second distribution module is configured to execute, when there is a user account with a failed reading in the first message queue and/or there is a user account with a failed storage in the database among the read user accounts, taking the user account with a failed reading and the user account with a failed storage as the first target user account with a failed resource distribution.
In one embodiment, the second distribution module is configured to perform the storing of the first target user account to the second message queue, the second message queue is used for storing the first target user account for a resource distribution service, and the resource distribution service is used for distributing the resource to the first target user account.
In one embodiment, the first distribution module is configured to execute storing the user account to the first message queue, the first message queue is used for storing the user account for the resource distribution service, and the resource distribution service is used for reading the user account from the first message queue and distributing resource to the read user account.
In one embodiment, the apparatus further comprises:
a failure cause determination module configured to perform determining a storage failure cause when storing the user account to the first message queue fails;
the second storage module is configured to determine a second server which has deployed a third message queue when the storage failure reason is that the first server where the first message queue is located has a fault, and store the user account in the third message queue;
the first distribution module is configured to perform distribution of resources to the user accounts in the third message queue.
In one embodiment, the apparatus further comprises:
and the fourth distribution module is configured to execute, when the resource distribution to the first target user account in the second message queue fails, the resource distribution to the first target user account with the failed resource distribution every second duration until the resource distribution is successful.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the resource distribution method according to any embodiment of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the resource distribution method according to any one of the embodiments of the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, which includes instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the resource distribution method described in any one of the above first aspect embodiments.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
after the user account meeting the resource distribution requirement is determined, the user account is stored in the first message queue, and the resource is distributed to the user account in the first message queue in real time, so that the resource can be distributed in real time under the condition of high concurrency, and the resource distribution efficiency is ensured. And determining a first target user account with resource distribution failure from the user accounts, storing the first target user account to the second message queue, and distributing resources to the first target user account in the second message queue, so that resource distribution omission of part of the user accounts caused by network jitter, equipment failure and the like can be avoided, and accurate resource distribution is ensured.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a diagram illustrating resource distribution in a related art, according to an example embodiment.
FIG. 2 is a diagram of an application environment illustrating a method of resource distribution, according to an example embodiment.
FIG. 3 is a flow diagram illustrating a method of resource distribution in accordance with an exemplary embodiment.
FIG. 4 is a flow diagram illustrating a method of resource distribution in accordance with an example embodiment.
FIG. 5 is a schematic diagram illustrating a resource distribution in accordance with an exemplary embodiment.
Fig. 6 is a block diagram illustrating a resource distribution apparatus according to an example embodiment.
FIG. 7 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in this disclosure are both information and data that are authorized by the user or sufficiently authorized by the parties.
The resource distribution method provided by the present disclosure can be applied to the application environment shown in fig. 1. The n terminals 110 interact with the server 120 through a network, where n is any positive integer. The terminal 110 has installed therein an application that enables a user account to participate in an interactive activity. The application program can be a video application program, an instant messaging application program, a shopping application program, a live broadcast application program and the like. The interactive activities may be holiday live activities, task spelling activities, and the like. The terminal 110 obtains the participation information of the user account participating in the interactive activity and sends the participation information to the server 120. The participation information may be task completion information, consumption information, etc., as the case may be. The server 120 is configured with a resource distribution system, and when determining that the user account satisfies the resource distribution requirement according to the participation information of the user account, the server 120 acquires resource information to be distributed corresponding to the user account, and stores the user account and the resource information corresponding to the user account in the first message queue. The server 120 obtains the user account and the resource information corresponding to the user account from the first message queue, and sends the resource to the terminal 110 where the user account is located according to the resource information. When the server 120 determines that there is a first user account with the resource distribution being failed in the user account, the first target user account and the resource information corresponding to the first target user account are stored to the second message queue. And acquiring a first target user account delivered by the second message queue when the delivery condition is met and resource information corresponding to the first target user account, and sending resources to the terminal 110 where the first target user account is located according to the resource information.
The terminal 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers.
Fig. 2 is a flowchart illustrating a resource distribution method according to an exemplary embodiment, where the resource distribution method is used in a server, as shown in fig. 2, and includes the following steps.
In step S210, a user account satisfying the resource distribution requirement is determined.
Specifically, the specific implementation manner for determining whether the user account satisfies the resource distribution requirement may be determined according to the actual situation. For example, resource distribution requirements are determined based on account ratings of user accounts. And when the server judges that the user account meets the account upgrading requirement according to the participation information of the user account, taking the user account as the user account meeting the resource distribution requirement. Or, the current participation is in the festival live activity, and the resource distribution requirement is determined according to the consumption of the user account. And when the server judges that the current consumption information of the user account meets a certain amount, taking the user account as the user account meeting the resource distribution requirement. Or, the current participation is the task spelling activity, and the resource distribution requirement is determined according to the task completion condition of the user account. And when the server judges that the user account completes the task, the user account is used as the user account meeting the resource distribution requirement.
In step S220, the user account is stored in the first message queue, and the resource is distributed to the user account in the first message queue.
Wherein, the message queue is a container for storing messages in the transmission process of the messages. The main purpose of the message queue is to provide routing and guarantee delivery of the message; if the recipient is not available when the message is sent, the message queue will hold the message until it can be successfully delivered. The Message Queue may be, but is not limited to, an Active Message Queue (Active Message Queue, an open source Message middleware), a RabbitMQ (rabbitmessage Queue, an open source Message middleware implementing an advanced Message Queue protocol), and Kafka (a high-throughput distributed publish-subscribe Message system), which are not specifically limited herein.
Specifically, when the server determines that the user account is an account satisfying the resource distribution requirement, the server stores the user account and the resource information of the user account to the first message queue in real time. And the server reads the user account and the resource information corresponding to the user account from the first message queue and distributes the virtual resources to the currently read user account in real time according to the resource information. Wherein the virtual resource may be characterized by an integral value, a virtual coin, a virtual gift, and the like.
In step S230, when there is a user account with resource distribution failure in the first message queue, the user account with resource distribution failure is used as a first target user account, the first target user account is stored in the second message queue, and the resource is distributed to the first target user account in the second message queue.
The user account with failed resource distribution can be, but not limited to, a user account with failed server reading, a user account with successful reading but failed resource distribution, and the like.
In one embodiment, the data consumption mode of the second message queue may adopt an active delivery mode, that is, the second message queue actively pushes a currently stored message. In another embodiment, the data consumption mode of the second message queue may adopt a data reading mode, that is, the server actively reads the currently stored message from the second message queue. The following examples are illustrated in an active delivery mode.
Specifically, when the server acquires a user account with resource distribution failure in the first message queue, the user account with resource distribution failure is used as a first target user account. And the server sends the first target user account and the resource information corresponding to the first target user account to the second message queue. And storing the first target user account and the resource information corresponding to the first target user account through the second message queue. And when the second message queue judges that the delivery condition is met currently, actively delivering the stored first target user account and the resource information corresponding to the first target user account to the server so that the server distributes virtual resources to the first target user account according to the resource information. The delivery condition may be configured according to actual requirements, for example, the number of messages in the second message queue satisfies a certain number, and the current time satisfies the delivery time.
According to the resource distribution method, after the user account meeting the resource distribution requirement is determined, the user account is obtained from the first message queue in real time, and the resource is distributed to the obtained user account, so that the resource can be distributed in real time under the condition of high concurrency, and the resource distribution efficiency is ensured. The method comprises the steps of determining a first target user account which fails in processing from user accounts, storing the first target user account into a second message queue, obtaining the first target user account delivered by the second message queue when delivery conditions are met, and distributing resources to the first target user account, so that resource distribution omission of part of user accounts caused by network jitter, equipment faults and the like can be avoided, and accurate resource distribution is ensured.
In an exemplary embodiment, the method further comprises: and when the resource distribution to the first target user account in the second message queue fails, distributing the resource to the first target user account with the failed resource distribution every second time length until the resource distribution is successful.
In particular, the second message queue may deliver the currently stored messages in a round robin fashion. In this case, if the reply message of successful delivery is not received after the second message queue delivers the first target user account, it is determined that the delivery of the first target user account fails. And the second message queue monitors the time interval between the current moment and the delivery failure, and delivers the first target user account and the resource information corresponding to the first target user account again when the time interval reaches a second duration until the first target user account is delivered successfully. The server obtains a first target user account with successful delivery and distributes resources to the first target user account. The second time period may be configured according to actual requirements, and for example, may be any one of 10 seconds, 1 minute, 2 minutes, 5 minutes, 10 minutes, and the like, which is not further limited herein.
In one embodiment, if the server fails to distribute the resource to the first target user account, the first target user account may be stored in the second message queue again until the resource is successfully distributed to the first target user account.
In this embodiment, the second message queue is configured to be in the circular active delivery mode, so that all messages stored in the second message queue can be ensured to be delivered successfully, the server can distribute resources to all user accounts meeting the resource distribution requirement, and the accuracy and comprehensiveness of resource distribution are ensured.
In an exemplary embodiment, the method further comprises: when reading a user account from the first message queue and distributing resources to the user account, storing the read user account and the resource distribution state corresponding to the read user account to a database; and acquiring a second target user account with the resource distribution state of non-distribution from the database every a first time length, and distributing the resource to the second target user account.
The first time period may be configured according to actual requirements, and may be any one of 1 minute, 2 minutes, 5 minutes, 10 minutes, and the like, for example, which is not further limited herein.
The resource distribution status includes distributed and non-distributed. After the server reads the user account from the first message queue and distributes the virtual resources to the user account, if the server obtains a reply message returned by the client side where the user account is located, the resource distribution state of the user account is determined to be distributed; and if the server acquires that the client of the user account does not return the reply message, determining that the resource distribution state of the user account is undistributed.
Specifically, when the server reads a user account from the first message queue and distributes resources to the read user account, the read user account and the resource information of the user account are stored in a preset database. And the server acquires the read resource distribution state of each user account and marks the user accounts in the database by using the acquired resource distribution state. For example, if the resource distribution status of the user account a is obtained as undistributed, the user account a in the database is marked as undistributed. And every first time interval, the server acquires a user account which is stored in the latest time interval and has a resource distribution state of non-distribution from the database as a second target user account. And distributing the resources to the second target user account according to the resource information corresponding to the second target user account. For example, a first duration of 1 minute is configured to process ten minutes of the stored user account each time. The current time is 10:00, namely for 9: 50-10: 00 the user accounts stored during this time period are processed.
In the embodiment, the user accounts and the resource distribution states of the user accounts are stored in the database, and the bottom-pocketing strategy for regularly processing the undistributed user accounts is deployed, so that the number of tasks needing to be regularly processed is greatly reduced compared with the related art, and the user accounts in the database can be effectively processed.
In an exemplary embodiment, one manner of determining the first target user account is described. Specifically, the server reads a first user account and resource information corresponding to the first user account from the first message queue, and when the reading fails, the user account is used as a first target user account. And when the server stores the read user accounts in the database, if the read user accounts have storage failure user accounts, taking the storage failure user accounts as the first target user accounts. The first target user account is then sent to a second message queue. And after the first target user account actively delivered by the second message queue is obtained, distributing the resources to the first target user account.
In this embodiment, the reading process of the first message queue and the storage process of the database are monitored, and the second message queue is used to actively deliver the user account with failed reading and storage, so that the processing pressure of the server can be reduced, and the condition of missed delivery can be avoided.
In an exemplary embodiment, storing a first target user account to a second message queue, and distributing resources to the first target user account in the second message queue, includes: the first target user account is stored to a second message queue, the second message queue is used to store the first target user account for a resource distribution service, and the resource distribution service is used to distribute resources to the first target user account.
Wherein a resource distribution service refers to a service for distributing resources to a user account. The resource distribution service can be deployed in a centralized manner in the central platform of the application program or can be deployed independently. Specifically, after storing the first target user account in the second message queue, the server delivers the first target user account to the resource distribution service through the second message queue when it is determined that the delivery condition is satisfied. And distributing the virtual resource to the first target user account according to the resource information through the resource distribution service.
In this embodiment, by deploying the resource distribution service for distributing the virtual resource, the problem of bandwidth limitation caused by an excessively large flow rate can be avoided, so that the real-time performance of resource distribution can be ensured, and the efficiency of resource distribution can be ensured.
In an exemplary embodiment, storing a user account to a first message queue, and distributing resources to the user account in the first message queue, includes: and storing the user account into a first message queue, wherein the first message queue is used for storing the user account for a resource distribution service, and the resource distribution service is used for reading the user account from the first message queue and distributing the resource to the read user account.
Specifically, the server stores the user account in the first message queue after determining the user account satisfying the resource distribution requirement. The resource distribution service reads the user account and resource information corresponding to the user account from the first message queue. And distributing the virtual resources to the user account according to the resource information.
In this embodiment, by deploying the resource distribution service for distributing the virtual resource, the problem of bandwidth limitation caused by an excessively large flow rate can be avoided, so that the real-time performance of resource distribution can be ensured, and the efficiency of resource distribution can be ensured.
In an exemplary embodiment, the method further comprises: when the user account is failed to be stored in the first message queue, determining a storage failure reason; and when the storage failure reason is that the first server where the first message queue is located has a fault, determining a second server where a third message queue is deployed, and storing the user account to the third message queue.
The first server and the second server may be implemented by independent servers or a server cluster composed of a plurality of servers. The third message queue may be a queue having at least the same functionality as the first message queue.
Specifically, after the server stores the user account in the first message queue, if the server obtains a successful sending message returned by the first message queue, it is determined that the user account is successfully stored. And if the server acquires that the first message queue does not return a message which is successfully sent, determining that the user account is unsuccessfully stored. And when the number of times of continuous storage failure reaches a preset number threshold, determining that the first server where the first message queue is located has a failure. The server may determine, from the backup server, a second server that has deployed the third message queue, and store the user account in the third message queue in the second server until receiving a feedback message that the storage is successful.
It is understood that, in this embodiment, in the case of storing a message in the third message queue, the user account stored in the third message queue will be processed subsequently, and the specific processing procedure may refer to the content described above with respect to the first message queue, which is not specifically described herein.
In this embodiment, by deploying a backup mechanism of the message queue, when the message queue cannot successfully receive the message, the pre-deployed backup message queue is switched to use, so that it is ensured that resource distribution can be performed normally.
The resource distribution method is explained below by a specific example. The resource distribution method is described as applied to the festival live broadcast.
Fig. 3 illustrates a resource distribution diagram in the related art. As shown in fig. 3, the payment service in the server obtains consumption information (e.g., salutation records) of the user account in the live broadcast room, and sends the consumption information to the resource determination service. The upgrading condition of the user account is calculated according to the consumption information through the resource determining service, and the user account meeting the account upgrading requirement and upgrading reward resource information (hereinafter, simply referred to as resource information) corresponding to the user account are determined. The upgrade message (i.e., the user account satisfying the upgrade requirement and the resource information corresponding to the user account) is sent to the message queue through the resource determination service. And reading the user account and the resource information corresponding to the user account from the message queue through the resource distribution service, and storing the read data to a database. And sending the upgraded reward resources to the user accounts by periodically polling the user accounts stored in the database for a last period of time. Due to the fact that the festival live broadcast activities often have the conditions of overlarge flow and concurrency, the overtime phenomenon caused by too many user accounts needing to be processed and incomplete distribution within a limited time is easy to occur, and therefore the problem that the reward resources of some user accounts are missed is caused.
FIG. 4 is a resource distribution diagram of the present disclosure shown in accordance with an example embodiment. Fig. 5 is a flowchart illustrating a resource distribution method according to an exemplary embodiment, and the resource distribution method of the present disclosure is described with reference to fig. 4 and 5, and includes the following steps.
In step S502, a user account satisfying the resource distribution requirement is determined.
Specifically, the payment service obtains consumption information of the user account, and sends the consumption information of the user account to the resource determination service. And determining whether the user account meets the account upgrading requirement or not through the resource determination service according to the consumption information, and if so, determining that the user account is the user account meeting the resource distribution requirement.
In step S504, the user account is stored in the first message queue, the user account is read from the first message queue, and the resource is distributed to the read user account.
Specifically, the upgrading condition of the user account is calculated according to the consumption information through the resource determining service, and the user account meeting the account upgrading requirement and the resource information corresponding to the user account are determined. And sending the user account meeting the upgrading requirement and the resource information corresponding to the user account to the first message queue through the resource determination service. And reading the user account and the resource information corresponding to the user account from the first message queue through the resource distribution service, and sending the upgrade rewarding resource to the user account according to the resource information corresponding to the user account.
Further, after the resource distribution service reads the user account from the first message queue, a unique identifier corresponding to the user account may be set, and idempotent is ensured by the unique identifier. The unique identification may be characterized by a user account identification or the like. That is, after the server distributes the resource to the user account, the unique identifier is marked as processed, and then the resource distribution of the user account corresponding to the unique identifier is not processed, so that the condition that the resource is repeatedly distributed to the same user account is avoided.
In step S506, when there is a user account that fails to be read in the first message queue, the user account that fails to be read is used as a first target user account, and the first target user account is stored in the second message queue.
The second message queue may be an associated queue of the first message queue, for example, a credit queue, a retry queue, or the like of the first message queue. The deadlock queue refers to a queue in which a message cannot be successfully read for some reason, and is put in a special role to ensure that the message is not discarded without any reason, and the queue is generally called a deadlock queue. The retry queue refers to that when the consumption end (i.e. the resource distribution service) fails to consume the message, the message is rolled back to the server again to prevent the message from being lost without any reason. The retry queue is generally divided into a plurality of retry levels, each retry level also generally setting a re-delivery delay, with a delivery delay increasing with a greater number of retries. For example, the message failed to consume for the first time and was stored in retry queue Q1, Q1 delayed 5 seconds for re-delivery, and the message was re-delivered after 5 seconds. If the message fails to be consumed again, the message enters a retry queue Q2, the re-delivery delay of Q2 is 10 seconds, and the message is delivered again after 10 seconds. And so on, the more retries the longer the time for re-delivery, and when the number of retries exceeds the delivery threshold, the message can be stored in the dead mail queue.
In step S508, when the resource is distributed to the read user account, the resource distribution status of the user account is acquired, and the read user account and the resource distribution status corresponding to the read user account are stored in the database.
Specifically, when the resource is distributed to the user account by the resource distribution service, the resource distribution service is also caused to store the read user account and the resource information corresponding to the user account in the database. And when the resource distribution service acquires the resource distribution state corresponding to the user account, marking the user account in the database by using the resource distribution state. Wherein the resource distribution state may be any one of distributed and non-distributed.
In step S510, when there is a user account that fails to be stored in the database among the read user accounts, the user account that fails to be stored is also used as the first target user account, and the user account that fails to be stored is stored in the second message queue.
In step S512, a first target user account to which the second message queue delivers when the delivery condition is satisfied is obtained, and the resource is distributed to the first target user account.
Specifically, the second message queue sends the first target user account and the resource information corresponding to the first target user account, which are currently stored, to the resource distribution service every second duration. And when the resource distribution service judges that the unique identifier corresponding to the first target user account is unprocessed, distributing the resource to the first target user account. The resource distribution service marks the unique identifier as processed after distributing the resource to the first target user account to ensure idempotency and avoid repeated transmission of the resource.
In step S514, a second target user account with the resource distribution status of non-distribution is obtained from the database every first duration, and the resource is distributed to the second target user account.
Specifically, a timing task is also deployed in the server, and the timing task is used as a bottom-of-pocket policy. And acquiring a second target user account which is stored in the latest period of time and has a resource distribution state of non-distribution from the database every first time interval through the timing task. And when the timing task judges that the unique identifier corresponding to the second target user account is unprocessed, distributing the resource to the second target user account.
Further, after the timed task distributes the resource to the second target user account, the resource distribution state of the second target user account in the database can be changed into the distributed state. And the unique identifier corresponding to the user account is marked as processed so as to ensure idempotent and avoid repeated sending of resources.
In this embodiment, the user account is stored in the first message queue, the user account is acquired from the first message queue in real time, and the resource is distributed to the acquired user account, so that the resource can be distributed in real time under the condition of high concurrency, and the efficiency of resource distribution is ensured. And storing the first target user account which fails in processing into a second message queue, acquiring the first target user account delivered by the second message queue when the delivery condition is met, and distributing resources to the first target user account, so that resource distribution omission of part of user accounts caused by network jitter, equipment failure and the like can be avoided, and accurate resource distribution is ensured. By deploying the timing task as a bottom-pocket strategy, the problems of network jitter, equipment failure and the like to a certain degree can be tolerated, and the condition of missed sending is ensured not to occur. In addition, in the related technology, the normal distribution responsibility of the timing task is decoupled, so that the timing task is only responsible for processing the user account with failed distribution, and the number of tasks to be processed by the timing task is greatly reduced. By setting the unique identifier to ensure idempotency, it can be ensured that resources are not repeatedly distributed to the same user account.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the above-mentioned flowcharts may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or the stages is not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a part of the steps or the stages in other steps.
It is understood that the same/similar parts between the embodiments of the method described above in this specification can be referred to each other, and each embodiment focuses on the differences from the other embodiments, and it is sufficient that the relevant points are referred to the descriptions of the other method embodiments.
Fig. 6 is a block diagram illustrating a resource distribution apparatus 600 according to an example embodiment. Referring to fig. 6, the apparatus includes an account determination module 602, a first distribution module 604, and a second distribution module 606.
An account determination module 602 configured to perform determining user accounts that meet resource distribution requirements; a first distribution module 604 configured to perform storing the user account to a first message queue, and distributing the resource to the user account in the first message queue; and the second distribution module 606 is configured to execute that when the user account with the resource distribution failure exists in the first message queue, the user account with the resource distribution failure is used as a first target user account, the first target user account is stored in the second message queue, and the resource is distributed to the first target user account in the second message queue.
In an exemplary embodiment, the apparatus 600 further comprises: the first storage module is configured to store the read user account and the read resource distribution state corresponding to the user account into a database when the user account is read from the first message queue and the resource is distributed to the user account; and the third distribution module is configured to acquire a second target user account with the resource distribution state of being undistributed from the database every first time length and distribute the resource to the second target user account.
In an exemplary embodiment, the second distribution module 606 is configured to execute, when there is a user account with a failed reading in the first message queue and/or there is a user account with a failed storage in the database in the read user accounts, taking the user account with a failed reading and the user account with a failed storage as the first target user account with a failed resource distribution.
In an exemplary embodiment, the second distribution module 606 is configured to perform storing the first target user account to a second message queue, the second message queue for storing the first target user account for a resource distribution service, the resource distribution service for distributing resources to the first target user account.
In an exemplary embodiment, the first distribution module 604 is configured to perform storing the user account to a first message queue, the first message queue being used for storing the user account for a resource distribution service, the resource distribution service being used for reading the user account from the first message queue and distributing the resource to the read user account.
In an exemplary embodiment, the apparatus 600 further comprises: a failure reason determining module configured to determine a storage failure reason when the storage of the user account to the first message queue fails; the second storage module is configured to determine a second server which has deployed a third message queue when the storage failure reason is that the first server where the first message queue is located has a fault, and store the user account in the third message queue; a first distribution module configured to perform distribution of resources to user accounts in the third message queue.
In an exemplary embodiment, the apparatus 600 further comprises: and the fourth distribution module is configured to execute the resource distribution to the first target user account with the resource distribution failure at intervals of a second duration when the resource distribution to the first target user account in the second message queue fails until the resource distribution is successful.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 7 is a block diagram illustrating an electronic device S00 for distributing resources to a user account, according to an example embodiment. For example, the electronic device S00 may be a server. Referring to FIG. 7, electronic device S00 includes a processing component S20 that further includes one or more processors and memory resources represented by memory S22 for storing instructions, such as applications, executable by processing component S20. The application program stored in the memory S22 may include one or more modules each corresponding to a set of instructions. Further, the processing component S20 is configured to execute instructions to perform the above-described method.
The electronic device S00 may further include: the power supply module S24 is configured to perform power management of the electronic device S00, the wired or wireless network interface S26 is configured to connect the electronic device S00 to a network, and the input/output (I/O) interface S28. The electronic device S00 may operate based on an operating system stored in the memory S22, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like.
In an exemplary embodiment, a computer-readable storage medium comprising instructions, such as the memory S22 comprising instructions, executable by the processor of the electronic device S00 to perform the above method is also provided. The storage medium may be a computer-readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program product comprising instructions executable by a processor of the electronic device S00 to perform the above method.
It should be noted that, the descriptions of the above-mentioned apparatus, the electronic device, the computer-readable storage medium, the computer program product, and the like according to the method embodiments may also include other embodiments, and specific implementations may refer to the descriptions of the related method embodiments, which are not described in detail herein.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for resource distribution, comprising:
determining a user account meeting the resource distribution requirement;
storing the user account to a first message queue, and distributing resources to the user account in the first message queue;
when the user account with the resource distribution failure exists in the first message queue, the user account with the resource distribution failure is used as a first target user account, the first target user account is stored in a second message queue, and the resource is distributed to the first target user account in the second message queue.
2. The resource distribution method of claim 1, wherein the method further comprises:
when the user account is read from the first message queue and resources are distributed to the user account, the read user account and the resource distribution state corresponding to the read user account are stored in a database;
and acquiring a second target user account with the resource distribution state of non-distribution from the database every a first time length, and distributing the resource to the second target user account.
3. The resource distribution method according to claim 2, wherein the regarding the user account with resource distribution failure as the first target user account when the user account with resource distribution failure exists in the first message queue comprises:
and when the user account which fails to be read exists in the first message queue and/or the user account which fails to be stored in the database exists in the read user accounts, taking the user account which fails to be read and the user account which fails to be stored as the first target user account which fails in resource distribution.
4. The resource distribution method of claim 1, wherein storing the first target user account in a second message queue and distributing the resource to the first target user account in the second message queue comprises:
storing the first target user account to the second message queue, the second message queue being used to store the first target user account for a resource distribution service, the resource distribution service being used to distribute resources to the first target user account.
5. The resource distribution method of claim 4, wherein storing the user account in a first message queue and distributing the resource to the user account in the first message queue comprises:
and storing the user account to the first message queue, wherein the first message queue is used for storing the user account for the resource distribution service, and the resource distribution service is used for reading the user account from the first message queue and distributing the resource to the read user account.
6. The resource distribution method according to any one of claims 1 to 5, characterized in that the method further comprises:
when the user account is failed to be stored in the first message queue, determining a storage failure reason;
when the storage failure reason is that a first server where the first message queue is located has a fault, determining a second server where a third message queue is deployed, and storing the user account into the third message queue;
the distributing resources to the user account in the first message queue includes:
distributing resources to the user accounts in the third message queue.
7. A resource distribution apparatus, comprising:
an account determination module configured to perform determining user accounts that meet resource distribution requirements;
a first distribution module configured to perform storing the user account to a first message queue, distributing resources to the user account in the first message queue;
and the second distribution module is configured to execute the steps that when the user account with the resource distribution failure exists in the first message queue, the user account with the resource distribution failure is used as a first target user account, the first target user account is stored in a second message queue, and the resource is distributed to the first target user account in the second message queue.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the resource distribution method of any one of claims 1 to 6.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the resource distribution method of any of claims 1-6.
10. A computer program product comprising instructions therein, which when executed by a processor of an electronic device, enable the electronic device to perform the resource distribution method of any one of claims 1 to 6.
CN202111263434.7A 2021-10-28 2021-10-28 Resource distribution method, device, electronic equipment and storage medium Active CN114007111B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111263434.7A CN114007111B (en) 2021-10-28 2021-10-28 Resource distribution method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111263434.7A CN114007111B (en) 2021-10-28 2021-10-28 Resource distribution method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114007111A true CN114007111A (en) 2022-02-01
CN114007111B CN114007111B (en) 2024-05-10

Family

ID=79924909

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111263434.7A Active CN114007111B (en) 2021-10-28 2021-10-28 Resource distribution method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114007111B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133302A (en) * 2017-04-28 2017-09-05 努比亚技术有限公司 Realize method, system, terminal and the computer-readable recording medium of data consistency
CN111949393A (en) * 2019-05-16 2020-11-17 腾讯科技(深圳)有限公司 Resource allocation and acquisition method, device, storage medium and equipment
CN112399192A (en) * 2020-11-03 2021-02-23 上海哔哩哔哩科技有限公司 Gift display method and system in network live broadcast
CN112915548A (en) * 2021-03-30 2021-06-08 腾讯科技(深圳)有限公司 Data processing method, device and equipment of multimedia playing platform and storage medium
CN113452486A (en) * 2021-08-31 2021-09-28 腾讯科技(深圳)有限公司 Vehicle information uploading method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133302A (en) * 2017-04-28 2017-09-05 努比亚技术有限公司 Realize method, system, terminal and the computer-readable recording medium of data consistency
CN111949393A (en) * 2019-05-16 2020-11-17 腾讯科技(深圳)有限公司 Resource allocation and acquisition method, device, storage medium and equipment
CN112399192A (en) * 2020-11-03 2021-02-23 上海哔哩哔哩科技有限公司 Gift display method and system in network live broadcast
CN112915548A (en) * 2021-03-30 2021-06-08 腾讯科技(深圳)有限公司 Data processing method, device and equipment of multimedia playing platform and storage medium
CN113452486A (en) * 2021-08-31 2021-09-28 腾讯科技(深圳)有限公司 Vehicle information uploading method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN114007111B (en) 2024-05-10

Similar Documents

Publication Publication Date Title
CN108449410B (en) Message management method, system and related device in cloud platform
CN110213371B (en) Message consumption method, device, equipment and computer storage medium
US20190173969A1 (en) Push notification delivery system
CN112527525B (en) Distributed event bus processing method, terminal and medium based on message queue
CN102523243B (en) The system and method that quick header is selected is provided in the distributed system of simple topology
CN107277083B (en) Data interaction processing method, device and system
CN115004673B (en) Message pushing method, device, electronic equipment and computer readable medium
CN112328418B (en) Method and system for improving MQ synchronization reliability
CN111711697A (en) Message pushing method, device, equipment and storage medium
CN111338773A (en) Distributed timed task scheduling method, scheduling system and server cluster
WO2021104178A1 (en) Dynamic message pushing method and system and vehicle diagnosis server
CN111931110B (en) Message pushing processing method, device and system
CN112689202A (en) Live broadcast room message processing method and device, server and storage medium
CN107908481A (en) A kind of method of data synchronization, device and system
CN110442461A (en) A kind of message dilivery method, storage medium
CN110544136A (en) Method, device, equipment and storage medium for calculating synchronous putting probability
CN114007111B (en) Resource distribution method, device, electronic equipment and storage medium
CN116401034A (en) Task execution method, computer device and computer storage medium
CN110971679B (en) Conference service scheduling method and device
US20090106781A1 (en) Remote call handling methods and systems
CN112671636B (en) Group message pushing method and device, computer equipment and storage medium
CN111191134B (en) Intelligent pushing method and terminal
CN113709214A (en) Message processing method and device, electronic equipment and storage medium
CN113806056A (en) Timed task processing method and device, computer equipment and storage medium
EP3123715B1 (en) Method of management of a conference involving a plurality of data processing devices

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant