Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment," another embodiment "means" at least one additional embodiment, "and" some embodiments "means" at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Fig. 1 is a flowchart of an embodiment of a method for controlling messaging according to an embodiment of the present disclosure, where the method for controlling messaging according to the embodiment may be performed by a messaging control device, and the messaging control device may be implemented in software, or a combination of software and hardware, and the messaging control device may be integrally provided in a device in a messaging control system, such as a messaging control server or a messaging control terminal device. As shown in fig. 1, the method comprises the steps of:
step S101, obtaining a message to be sent;
Optionally, the message to be sent is a message generated by a sending device of the message or a message to be forwarded received by the server from the terminal device. In an exemplary live broadcast scenario, a plurality of terminal devices located in the same live broadcast room send messages to a server providing live broadcast services, then the plurality of terminals regularly pull all messages in a previous period from the server, and after receiving a pull instruction, the server sends the messages cached in the previous period to the terminal corresponding to the pull instruction.
The message to be sent is buffered in a server, the terminal device sends a pull request of the message every unit time, and the server fetches the messages buffered in the last unit time from the buffer after receiving the pull request. Wherein each of the cached messages is a message to be sent in the step. Optionally, the message to be sent is cached in a queue, and when the server acquires the message to be sent, one message to be sent is fetched from the top of the queue at a time.
Illustratively, in the live broadcast scenario, the message to be sent is a chat message, a gift message, or the like acquired from all terminals joining the live broadcast room.
Step S102, determining the priority of the message to be sent;
in the embodiment of the disclosure, all the messages have corresponding priorities, and the priorities are preset identifiers for representing importance degrees of the messages.
Optionally, the step S102 includes:
Step S201, determining the type of the message to be sent;
step S202, determining the priority of the message to be sent according to the type.
Optionally, in a messaging system, the messages are divided into a plurality of types, and exemplary, the messages are divided into type a messages and type B messages, each type of message is pre-prioritized, e.g., the type a message is prioritized to a first priority and the type B message is prioritized to a second priority, further, each type of message may be further subdivided into sub-types, e.g., the type B message may be further subdivided into type B1 messages and type B2 messages, and in the sub-types, there may be further sub-priorities, where in the case of the second priority, the sub-priority of the type B1 message is higher than the sub-priority of the type B2 message. Taking the live broadcast scenario as an example, the messages in live broadcast can be generally divided into chat messages and gift messages, wherein the priority of the chat messages is 1, and the priority of the gift messages is 2, and the gift can be divided into gift 1 and gift 2 due to different types, wherein the priority of the gift 1 is 2.1, and the priority of the gift 2 is 2.2. Thus, in step S202, the priority of the message can be determined by the type of the message.
Optionally, before the step S101 or the step S102, a priority is set for each type of message. Optionally, the priority of each type of message can be automatically set according to the number of the historical messages, for example, the number of the messages is counted, the priority is automatically set according to the number of the messages, and the lower the corresponding priority is, the lower the corresponding number of the messages is, and the corresponding priority is higher. As in the live scenario described above, the priority of chat messages may be set lower than the priority of gift messages, and then in the gift messages, the priority of gift 1 is lower than the priority of gift 2, and so on.
Optionally, before the step S101 or the step S102, the method further includes:
a number threshold is set for messages of different priorities. Optionally, the number threshold of messages of high priority is not less than the number threshold of messages of low priority. That is, a high priority message may send more than a low priority message.
Step S103, determining a first quantity;
Wherein the first number is the number of messages of the priority that have been sent before the message to be sent was sent. In this step, after determining the priority of the message to be sent, a first number of messages of said priority that have been sent is obtained. For example, if the priority of the message to be sent is the first priority, the number of messages of the first priority that have been sent before the message to be sent is obtained.
Alternatively, the number of messages of different priorities that have been sent is recorded by setting a counter to the messages of different priorities. Such as a first priority counter, which is incremented by 1 each time a first priority message is sent. When the first number needs to be acquired, the value of the counter is read.
Optionally, the step S103 includes:
step S301, a time stamp of the message to be sent is obtained;
step S302, determining a first number of messages of the priority that have been sent in a unit time according to the timestamp.
In this alternative embodiment, each message to be sent is provided with a timestamp T, which is shown in seconds, that is, the message to be sent is obtained in step S301, it is understood that, since many messages in one second are obtained, the second-level timestamps of many messages are the same, and at this time, the messages of the same type can be distinguished according to the ID or the sequence number of the message or the lower-level timestamp, which is not described herein.
Optionally, in step S302, the timestamp corresponds to the unit time, for example, the unit time is a period in which the terminal pulls the message from the server, for example, 1 second once, and the accuracy of the timestamp is also 1 second, where the timestamp and the unit time may be directly corresponding to each other, for example, t=1, and the number of the messages with the priorities that have been sent and have the timestamp of t=1 is directly calculated to be the first number.
Optionally, as described above, the first data corresponding to the messages with different priorities is recorded by a counter. At this time, after the step S101, further includes:
step S401, obtaining a first time stamp of the message to be sent;
In step S402, if the first timestamp is different from the second timestamp of the last message to be sent, a counter corresponding to the first timestamp is started, where the counter is used to record the number of sent messages with the timestamp being the first timestamp.
In this alternative embodiment, the timestamp of the message corresponds to a unit of time, i.e., when the timestamp changes, indicating the message pull into the next period. Thus, in the following S401, the first timestamp of the message to be sent is obtained, and in step S402, it is compared whether the first timestamp is the same as the second timestamp of the last message to be sent, and if it is different, the two messages are located in different pull periods, at which time a counter is started for the first timestamp to record the number of sent messages whose timestamp is the first timestamp.
Alternatively, since the server corresponds to a plurality of terminals, each terminal has different processing capabilities, the first number of messages sent under each priority level is recorded independently for different terminals. The number of messages that have been sent is calculated for each priority, e.g. for each terminal in the living room.
Step S104, discarding the message to be sent when the first number is greater than or equal to the number threshold corresponding to the priority;
wherein the number threshold of messages of different priorities is related to the priority of the message. Illustratively, the number of high priority messages is not less than the number of low priority messages. I.e. the greater the priority of a message, the greater the number of messages that can be sent.
In this step, it is determined whether the first number is greater than or equal to a preset number threshold, and if so, the message to be sent is discarded, because the message sent at this time already exceeds the processing capability of the corresponding terminal, and even if the data to be sent is sent to the terminal, the terminal cannot process the data.
By the technical scheme, the number threshold is independently set for the messages with different priorities, so that the problems that the terminal cannot process the messages or the client terminal processing the messages on the terminal crashes and the like caused by too many messages can be effectively controlled. And because the quantity threshold values are independently set for different priorities, the important messages can be guaranteed to be processed preferentially, so that the flow of the messages can be controlled, and the important messages can be guaranteed not to be lost.
Further, after the step S104, the method further includes:
transmitting the message to be transmitted under the condition that the first number is smaller than a number threshold corresponding to the priority;
the first number is accumulated.
That is, if the preset number threshold is not exceeded, the message is transmitted, and the number of transmitted messages corresponding to the priority of the message is accumulated.
On the basis of the above technical solution, optionally, step S302 includes:
And responding to the first sub-priority of which the priority of the message to be sent is the first priority, and determining the first quantity of the messages of the first priority which are sent in unit time according to the time stamp, wherein the first quantity is recorded in the unit time determined by the next time stamp.
Wherein the first sub-priority is a high-level sub-priority under the first priority. In this alternative embodiment, the sent number of messages of the first sub-priority is recorded in a counter used in the next time period. For example, in a live scene, the gift message includes gift 1 and gift 2, wherein the child priority of gift 2 is higher, and since the counter of the gift message is commonly used by gift 1 and gift 2, there may be a case that the number of gift 1 is too large, the threshold value of the number of first priority is consumed, and more important gift 2 cannot be transmitted. Thus, in this alternative embodiment, the first sub-priority message is counted using a counter used per unit time as determined by the next timestamp. If the timestamp of the message to be sent is T, the counter of the first priority of the T+1 timestamp is used for counting the sent messages of the first sub-priority.
Optionally, the step S302 includes:
and responding to the second sub-priority of which the priority of the message to be sent is the first priority, and determining the first quantity of the messages of the first priority which are sent in the unit time of the time stamp according to the time stamp, wherein the quantity of the messages of the first priority which are sent comprises the quantity of the messages of the first sub-priority of the first priority which are sent in the last unit time.
In this alternative embodiment, if the priority of the message to be sent is the second sub-priority of the first priority, the first number of messages of the first priority is read from the counter corresponding to the unit time in which the timestamp is located. It should be noted that, in addition to the counter corresponding to the first timestamp, the counters of the messages of the first priority corresponding to the other timestamps include the number of the messages of the first sub-priority of the first priority sent in the previous unit time. I.e. the number of messages of the second sub-priority transmitted in the previous period, the number of messages of the second sub-priority transmitted in the previous period being included in the number of transmitted messages of the first priority in the current period.
Fig. 5 is an example of the message counting method described above. As shown in fig. 5, the system includes two messages, message a and message B, where message B can be further divided into message B1 and message B2, where message a has a lower priority than message B, message B1 has a lower priority than message B2, all messages a that have been sent out are counted by counter countA _t1 at time T1, all messages B1 that have been sent out are counted by countB _t1, all messages B2 that have been sent out are counted by countB _t2, and so on. In this way, since the counter of the next period used by the message B2 counts, it can be ensured that the message B2 is sent out, so that the message with the higher priority can be ensured to be sent out.
Optionally, the method for controlling message sending further includes:
Determining whether the number of all sent messages is greater than or equal to a total threshold value if the first number is less than a number threshold value corresponding to the priority;
Discarding the message to be sent if the number of all sent messages is greater than or equal to the total threshold;
and if the number of all the sent messages is smaller than the total number threshold value, sending the messages to be sent, and accumulating the first number.
In the above alternative embodiment, it is also necessary to set a total threshold, which may be the maximum capability of the terminal device to process messages, which is smaller than the sum of the number thresholds of messages of the respective priorities. At this time, when the number of messages having sent the priority is smaller than the number threshold, it cannot be guaranteed that the terminal device can process the messages to be sent, it needs to be further confirmed whether the number of all sent messages is greater than or equal to the total number threshold, and if all sent messages are greater than or equal to the total number threshold, the messages to be sent are discarded. Otherwise, the message to be sent is sent, and the first number of the messages with the priority sent is accumulated. By way of example, the message includes message a, message B and message C, where the number of messages a is 20, the number of messages B is 30, the number of messages C is 50, and the total number is 80, then if the number of messages a sent is 10, the number of messages B sent is 20, and the number of messages C sent is 50, then since the total number of messages sent is 80, even if the number of messages a and B sent has not reached the number threshold, they are discarded.
Fig. 6 is a schematic diagram of an application scenario in an embodiment of the disclosure. As shown in fig. 6, in this application scenario, a plurality of terminal devices 601-603 and a server 604 are included, wherein the plurality of terminal devices interact with the server via wired or wireless links. As shown in fig. 6, a process of sending a message in a live broadcast scenario is shown, in which, in a certain period of time, terminal devices 601-603 send messages to other terminals in the live broadcast room, where the messages are cached on the server 604, and then after the server receives a pull instruction of the terminal device, the cached messages are sent to the corresponding terminal devices. Since the processing capability of each terminal device may be different, the upper limit of messages that can be processed per unit time (e.g. 1 second) of each terminal device or each type of terminal device may be configured on the server, for example, 100 messages per second, that is, the total threshold described above, and using the technical solution in the embodiment of the present disclosure, a threshold of number per unit time may be set for each different type of message, for example, 50 chat messages and 50 gift messages, so that when the chat messages that have been sent in 1 second exceed 50 or the gift messages exceed 50, the corresponding type of messages are discarded, and further, the gift messages may be classified into a gift message and a gift message B, where the priority is higher due to higher value, as described above, in order to enable the gift B message to be sent out, the count of the gift B is recorded by the counter of the next period, so that the gift B can be ensured to be sent out. Assuming that 50 chat messages, gift a and gift B are generated during the T period, the gift B can be guaranteed to be transmitted since it uses the counter of the t+1 period. By the time t+1, since the counter of the gift message has been counted up to 50, the gift a is discarded in its entirety in the time t+1, and the gift B can be guaranteed to be sent out using the counter of the time t+1. In general, since the value of the gift B is high, the message of the gift B is not always generated at the above speed, so that it is ensured that the total number of messages after the period t+1 is generally not more than 100, so as to maintain the balance between the transmission speed of the server and the processing speed of the terminal device.
The embodiment of the disclosure discloses a method, a device, an electronic device and a computer readable storage medium for controlling message transmission. The message transmission control method comprises the steps of obtaining a message to be transmitted, determining the priority of the message to be transmitted, determining a first quantity, wherein the first quantity is the quantity of messages with the priority, which are transmitted before the message to be transmitted is transmitted, and discarding the message to be transmitted when the first quantity is greater than or equal to a quantity threshold corresponding to the priority. The method determines whether to send the message or not through the quantity threshold corresponding to the priority of the message, and solves the technical problem of message backlog caused by low terminal processing speed.
In the foregoing, although the steps in the foregoing method embodiments are described in the foregoing order, it should be clear to those skilled in the art that the steps in the embodiments of the disclosure are not necessarily performed in the foregoing order, but may be performed in reverse order, parallel, cross, etc., and other steps may be further added to those skilled in the art on the basis of the foregoing steps, and these obvious modifications or equivalent manners are also included in the protection scope of the disclosure and are not repeated herein.
Fig. 7 is a schematic structural diagram of an embodiment of a control device for message transmission according to an embodiment of the present disclosure. As shown in fig. 7, the apparatus 700 includes a message to be transmitted acquisition module 701, a priority determination module 702, a first number determination module 703, and a control module 704. Wherein, the
A message to be sent acquisition module 701, configured to acquire a message to be sent;
A priority determining module 702, configured to determine a priority of the message to be sent;
a first number determining module 703, configured to determine a first number, where the first number is a number of messages of the priority that have been sent before the message to be sent is sent;
and a control module 704, configured to discard the message to be sent if the first number is greater than or equal to a number threshold corresponding to the priority.
Further, the control module 704 is further configured to:
and under the condition that the first quantity is smaller than a quantity threshold corresponding to the priority, sending the message to be sent, and accumulating the first quantity.
Further, the first number determining module 703 is further configured to:
Acquiring a time stamp of the message to be sent;
A first number of messages of the priority that have been sent in a unit time is determined from the timestamp.
Further, the first number determining module 703 is further configured to:
and determining a first number of messages of the first priority, which have been transmitted in a unit time, according to the time stamp in response to the priority of the message to be transmitted being a first sub-priority of the first priority, wherein the first number is recorded in the unit time determined by the next time stamp.
Further, the first number determining module 703 is further configured to:
And responding to the second sub-priority of which the priority of the message to be sent is the first priority, and determining the first quantity of the messages of the first priority which are sent in the unit time of the time stamp according to the time stamp, wherein the first quantity of the messages of the first priority which are sent comprises the quantity of the messages of the first sub-priority of the first priority which are sent in the last unit time.
Further, the control module 704 is further configured to:
Determining whether the number of all sent messages is greater than or equal to a total threshold value if the first number is less than a number threshold value corresponding to the priority;
Discarding the message to be sent if the number of all sent messages is greater than or equal to the total threshold;
and if the number of all the sent messages is smaller than the total number threshold value, sending the messages to be sent, and accumulating the first number.
Further, the priority determining module 702 is further configured to:
Determining the type of the message to be sent;
And determining the priority of the message to be sent according to the type.
Further, the apparatus 700 further includes:
And the quantity threshold setting module is used for setting quantity thresholds for messages with different priorities, wherein the quantity threshold of the messages with high priority is not smaller than the quantity threshold of the messages with low priority.
Further, the apparatus 700 further includes:
And if the first time stamp is different from the second time stamp of the last message to be sent, starting a counter corresponding to the first time stamp, wherein the counter is used for recording the number of the sent messages with the time stamp being the first time stamp.
The apparatus of fig. 7 may perform the method of the embodiment of fig. 1-5, and reference is made to the relevant description of the embodiment of fig. 1-5 for parts of this embodiment not described in detail. The implementation process and the technical effect of this technical solution are described in the embodiments shown in fig. 1 to 5, and are not described herein.
Referring now to fig. 8, a schematic diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, the electronic device 800 may include a processing means (e.g., a central processor, a graphics processor, etc.) 801, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
In general, devices may be connected to I/O interface 805 including input devices 806 such as a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc., output devices 807 including a Liquid Crystal Display (LCD), speaker, vibrator, etc., storage devices 808 including magnetic tape, hard disk, etc., and communication devices 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 shows an electronic device 800 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 809, or installed from storage device 808, or installed from ROM 802. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 801.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to electrical wiring, fiber optic cable, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be included in the electronic device or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to obtain an input image and a first text, extract features of the input image to obtain feature vectors of the input image, encode the first text to obtain feature vectors of the first text, obtain joint feature vectors according to the feature vectors of the input image and the feature vectors of the first text, and decode the joint feature vectors to generate a second text.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic that may be used include Field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems-on-a-chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a method of controlling message transmission, including:
Acquiring a message to be sent;
Determining the priority of the message to be sent;
determining a first number, wherein the first number is the number of messages of the priority that have been sent prior to the sending of the message to be sent;
And discarding the message to be sent when the first number is greater than or equal to a number threshold corresponding to the priority.
Further, the method further comprises:
transmitting the message to be transmitted under the condition that the first number is smaller than a number threshold corresponding to the priority;
the first number is accumulated.
Further, the determining the first number includes:
Acquiring a time stamp of the message to be sent;
A first number of messages of the priority that have been sent in a unit time is determined from the timestamp.
Further, the determining, according to the timestamp, the first number of messages of the priority that have been sent in a unit time includes:
and determining a first number of messages of the first priority, which have been transmitted in a unit time, according to the time stamp in response to the priority of the message to be transmitted being a first sub-priority of the first priority, wherein the first number is recorded in the unit time determined by the next time stamp.
Further, the determining, according to the timestamp, the first number of messages of the priority that have been sent in a unit time includes:
And responding to the second sub-priority of which the priority of the message to be sent is the first priority, and determining the first quantity of the messages of the first priority which are sent in the unit time of the time stamp according to the time stamp, wherein the first quantity of the messages of the first priority which are sent comprises the quantity of the messages of the first sub-priority of the first priority which are sent in the last unit time.
Further, the method further comprises:
Determining whether the number of all sent messages is greater than or equal to a total threshold value if the first number is less than a number threshold value corresponding to the priority;
Discarding the message to be sent if the number of all sent messages is greater than or equal to the total threshold;
and if the number of all the sent messages is smaller than the total number threshold value, sending the messages to be sent, and accumulating the first number.
Further, the determining the priority of the message to be sent includes:
Determining the type of the message to be sent;
And determining the priority of the message to be sent according to the type.
Further, before the obtaining the message to be sent, the method further includes:
a number threshold is set for messages of different priorities, wherein the number threshold for messages of high priority is not smaller than the number threshold for messages of low priority.
Further, after the obtaining the message to be sent, the method further includes:
Acquiring a first timestamp of the message to be sent;
And if the first time stamp is different from the second time stamp of the last message to be sent, starting a counter corresponding to the first time stamp, wherein the counter is used for recording the number of sent messages with the time stamp being the first time stamp.
According to one or more embodiments of the present disclosure, there is provided a control apparatus for message transmission, including:
The message to be sent acquisition module is used for acquiring the message to be sent;
a priority determining module, configured to determine a priority of the message to be sent;
A first number determining module configured to determine a first number, where the first number is a number of messages of the priority that have been sent before the message to be sent is sent;
and the control module is used for discarding the message to be sent when the first number is greater than or equal to a number threshold corresponding to the priority.
Further, the control module is further configured to:
and under the condition that the first quantity is smaller than a quantity threshold corresponding to the priority, sending the message to be sent, and accumulating the first quantity.
Further, the first number determining module is further configured to:
Acquiring a time stamp of the message to be sent;
A first number of messages of the priority that have been sent in a unit time is determined from the timestamp.
Further, the first number determining module is further configured to:
and determining a first number of messages of the first priority, which have been transmitted in a unit time, according to the time stamp in response to the priority of the message to be transmitted being a first sub-priority of the first priority, wherein the first number is recorded in the unit time determined by the next time stamp.
Further, the first number determining module is further configured to:
And responding to the second sub-priority of which the priority of the message to be sent is the first priority, and determining the first quantity of the messages of the first priority which are sent in the unit time of the time stamp according to the time stamp, wherein the first quantity of the messages of the first priority which are sent comprises the quantity of the messages of the first sub-priority of the first priority which are sent in the last unit time.
Further, the control module is further configured to:
Determining whether the number of all sent messages is greater than or equal to a total threshold value if the first number is less than a number threshold value corresponding to the priority;
Discarding the message to be sent if the number of all sent messages is greater than or equal to the total threshold;
and if the number of all the sent messages is smaller than the total number threshold value, sending the messages to be sent, and accumulating the first number.
Further, the priority determining module is further configured to:
Determining the type of the message to be sent;
And determining the priority of the message to be sent according to the type.
Further, the device further comprises:
And the quantity threshold setting module is used for setting quantity thresholds for messages with different priorities, wherein the quantity threshold of the messages with high priority is not smaller than the quantity threshold of the messages with low priority.
Further, the device further comprises:
And if the first time stamp is different from the second time stamp of the last message to be sent, starting a counter corresponding to the first time stamp, wherein the counter is used for recording the number of the sent messages with the time stamp being the first time stamp.
According to one or more embodiments of the present disclosure, there is provided an electronic device comprising at least one processor, and a memory communicatively coupled to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of controlling messaging of any of the preceding aspects.
According to one or more embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer instructions for causing a computer to execute the control method of message transmission of any one of the foregoing first aspects.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).