CN111585774B - Session updating method and storage medium - Google Patents

Session updating method and storage medium Download PDF

Info

Publication number
CN111585774B
CN111585774B CN202010212698.9A CN202010212698A CN111585774B CN 111585774 B CN111585774 B CN 111585774B CN 202010212698 A CN202010212698 A CN 202010212698A CN 111585774 B CN111585774 B CN 111585774B
Authority
CN
China
Prior art keywords
group
data structure
session
messages
consumer program
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.)
Active
Application number
CN202010212698.9A
Other languages
Chinese (zh)
Other versions
CN111585774A (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.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology 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 Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN202010212698.9A priority Critical patent/CN111585774B/en
Publication of CN111585774A publication Critical patent/CN111585774A/en
Application granted granted Critical
Publication of CN111585774B publication Critical patent/CN111585774B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • H04L12/1813Arrangements for providing special services to substations for broadcast or conference, e.g. multicast for computer conferences, e.g. chat rooms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/07User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
    • H04L51/18Commands or executable codes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a session updating method and a storage medium, wherein the method comprises the following steps: when a consumer program acquires a group of messages from an MQ, asynchronously storing a group ID of the group of messages into a data structure of a local memory; scanning the data structure at regular time, sending the scanned group ID to a corresponding consumer program, and clearing the data structure after the scanning is finished; and after receiving the group ID, the consumer program updates the conversation list sequence of the group member corresponding to the group ID. The invention updates the group session regularly, which greatly reduces the times of writing data base and effectively relieves the pressure between the system and the database; meanwhile, the session list still has higher timeliness, and the instant updating effect of the group message is not influenced; furthermore, the invention has the advantages of simple implementation mode, little memory resource occupation, high practicability and the like.

Description

Session updating method and storage medium
Technical Field
The invention relates to the field of IM projects, in particular to a session updating method and a storage medium.
Background
Today, most mobile phone APPs provide message pushing functions, such as hot news recommendation of news clients, chat message reminding of IM tools, e-commerce product promotion information, notification and approval processes of enterprise applications, and the like. The push plays an important role in improving the activity of products, the utilization rate of functional modules, the viscosity of users and the retention rate of users.
Many IM software have the capability of a personal conversation list. The personal conversation list refers to a list of sending and receiving messages between a person and other people, and each record in the conversation list is a chat record of the person and other people and comprises person and group chatting. Say a chats with both B and C, and the chat time of C is updated, the order of the session list is C, B. If there is still a group chat D time update at this time, the order of the session list is D, C, B.
In order to achieve the above-mentioned effect of automatically updating the conversation ranking according to the chat time, a general system is to synchronously update information to the personal conversation list asynchronously every time a personal message or a group chat message is sent. In this scenario, if there are 1000 people in a group when group chat is performed, the personal conversation list information of the 1000 people needs to be modified each time a group message is sent, which may cause a large stress on the system and the database.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the session updating method and the storage medium are provided, so that the times of writing the database are greatly reduced, and the pressure of a system and the database is effectively relieved.
In order to solve the technical problems, the invention adopts the technical scheme that:
a method of session update, comprising:
when a consumer program acquires a group of messages from an MQ, asynchronously storing a group ID of the group of messages into a data structure of a local memory;
scanning the data structure at regular time, sending the scanned group ID to a corresponding consumer program, and clearing the data structure after the scanning is finished;
and after receiving the group ID, the consumer program updates the conversation list sequence of the group member corresponding to the group ID.
The invention provides another technical scheme as follows:
a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, is able to carry out the steps included in the method for session update.
The invention has the beneficial effects that: and recording the group ID updated with the message in a specified data structure of a local memory, scanning the data structure at regular time, emptying and re-recording after the scanning is finished, and realizing the regular unified update of the group session sequencing. Compared with the prior art that a large amount of database writing operations need to be frequently executed due to real-time group session updating, the method and the device can greatly reduce the times of writing the database and effectively relieve the pressure of the system and the database.
Drawings
Fig. 1 is a flowchart illustrating a session update method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a session update method according to an embodiment of the present invention.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
The most key concept of the invention is as follows: and recording the group ID updated with the message in a specified data structure of a local memory, scanning the data structure at regular time, emptying and re-recording after the scanning is finished, and realizing the regular unified update of the group session sequencing.
Referring to fig. 1, the present invention provides a method for session update, including:
when a consumer program acquires a group of messages from an MQ, asynchronously storing a group ID of the group of messages into a data structure of a local memory;
scanning the data structure at regular time, sending the scanned group ID to a corresponding consumer program, and clearing the data structure after the scanning is finished;
and after receiving the group ID, the consumer program updates the conversation list sequence of the group member corresponding to the group ID.
Further, still include:
when a consumer program obtains a group of messages from the MQ, the group of messages is sent to the corresponding group members.
According to the above description, the group message is still updated normally in real time, and the immediacy of the message is ensured.
Further, the asynchronously storing the group ID of the group of messages into a data structure of a local memory specifically includes:
and storing the group ID of the group of messages as a key into a map data structure of a local memory through an asynchronous thread.
As can be seen from the above description, storing the identification information of the group whose message is updated in a map manner has the advantages of simple and clear structure, and being beneficial to the subsequent scanning operation.
Further, the updating of the session list ordering of the group members corresponding to the group ID specifically includes:
acquiring a session list of each group member of the group corresponding to the group ID;
and reordering the conversation list of each group member according to the currently acquired personal message and the group ID.
According to the description, the individual conversation and the group conversation are respectively obtained, the finally combined sequencing result is used as a display effect, and the accurate sequencing of the conversation list of the user can be ensured.
The invention provides another technical scheme as follows:
a computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the steps of a method for session update comprising:
a method of session update, comprising:
when a consumer program acquires a group of messages from an MQ, asynchronously storing a group ID of the group of messages into a data structure of a local memory;
scanning the data structure at regular time, sending the scanned group ID to a corresponding consumer program, and clearing the data structure after the scanning is finished;
and after receiving the group ID, the consumer program updates the conversation list sequence of the group member corresponding to the group ID.
Wherein, still include:
when a consumer program obtains a group of messages from the MQ, the group of messages is sent to the corresponding group members.
Wherein the asynchronously storing the group ID of the group of messages into a data structure of a local memory specifically comprises:
and storing the group ID of the group of messages as a key into a map data structure of a local memory through an asynchronous thread.
Wherein, the updating of the session list ordering of the group members corresponding to the group ID specifically includes:
acquiring a session list of each group member of the group corresponding to the group ID;
and reordering the conversation list of each group member according to the currently acquired personal message and the group ID.
As can be understood from the above description, those skilled in the art can understand that all or part of the processes in the above technical solutions can be implemented by instructing related hardware through a computer program, where the program can be stored in a computer-readable storage medium, and when executed, the program can include the processes of the above methods. The program can also achieve advantageous effects corresponding to the respective methods after being executed by a processor.
The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
Example one
Referring to fig. 2, the present embodiment provides a method for optimizing a session update mode of an IM application, where the method includes:
s1: modifying the acquisition mode of the personal conversation list: distinguishing two types of personal conversation and group conversation in the personal conversation list;
correspondingly, when data of the personal conversation list is acquired each time, data of the personal conversation type and data of the group conversation type need to be acquired respectively, and the acquired data and the data are returned after being merged.
S2: when a consumer program acquires a group of messages from an MQ, asynchronously storing a group ID of the group of messages into a data structure of a local memory;
specifically, after a person in a group sends a chat message, the group message is sent to MQ in advance; when the consumer program gets the group message from the MQ, the prior art will perform the following: 1. sending the group message to other members of the group; 2. the personal conversation list for each member of the group is updated asynchronously. In the present embodiment, however, the above "1" is executed, and thereafter, the "2" is not executed, but: the group ID corresponding to the group message is asynchronously stored in a data structure of the local memory, which can be understood as a designated storage location. It is understood that the group ID of the group in which the message is updated is recorded to a specified location in the local memory.
Preferably, the data structure is in the form of map, where the key corresponds to the group ID, and the corresponding value may not be set, or the corresponding message time may be set. That is, the data structure functions to store information of the group in which the message is updated.
That is, as long as someone sends a message in each group, in addition to synchronizing the message to the group session interfaces of other members in the group, the group ID of the group is also stored in the MAP data structure in the local memory, and keys are corresponding group IDs, and each time the key is covered by using put operation.
S3: scanning the data structure at regular time, sending the scanned group ID to a corresponding consumer program, and clearing the data structure after the scanning is finished;
specifically, another asynchronous thread scans the data structure every preset time period (e.g., 15 seconds), and sends the currently traversed key value, i.e., the group ID (asynchronous) to the consumer program by traversing the map data structure, and after all the key values are traversed, deletes the map data structure, i.e., clears all the key values, and returns to step S2.
S4: and after receiving the group ID, the consumer program updates the conversation list sequence of the group member corresponding to the group ID.
After the MQ consumer program receives the asynchronous message sent in the previous step, the session list of all group members is obtained according to the group ID recorded in the asynchronous message; then, corresponding to each group member, the data of the human conversation type and the group ID recorded in the asynchronous message (thus obtaining the data of the group conversation type) obtained in step S1 are reordered according to the obtained time and displayed.
Through the embodiment, the personal conversation lists of all group members which need to be updated synchronously each time of sending the group message are changed into the unified updating at intervals, so that the times of writing the database are greatly reduced, and the pressure of the system and the database is reduced.
Example two
This embodiment provides a specific application scenario corresponding to the first embodiment:
1. firstly, a personal session list acquisition mode needs to be correspondingly modified, personal sessions and group session types are distinguished in a personal session list, and personal session type data and group session type data need to be respectively acquired and finally merged and returned when the personal session list data is acquired.
2. When a person in a group sends a chat message, a group message is sent to MQ, and when a consumer program obtains the message, the old program does 2 things: one is to send this message to the people in the group; another is to update each person's personal conversation list asynchronously. Here, the second thing needs to be modified, each group retains one piece of information in the memory, the data structure in the memory is in a Map mode, the key is the corresponding group ID, and the value may not be set. The function of the in-memory data structure is to store the latest messaging group information.
3. Assuming that there are 3 clusters of A, B and C, the corresponding cluster IDs are 1, 2, and 3, respectively. When the message is sent in each group, the information is synchronously stored in the MAP data structure in the local memory, the keys are the corresponding group IDs respectively, and the covering is carried out by using put operation each time.
4. There is an asynchronous thread that scans the MAP structure in local memory at regular intervals. The time interval may be determined according to a specific service. We assume this to be 15 seconds. The asynchronous thread loops through the data structure in the MAP, and sends an asynchronous message as long as the MAP has the group ID of the information. The message content is the group ID. And after all data information in the MAP is traversed, deleting the MAP structure, and performing the next cycle of writing operation in step 3.
5. When the MQ consumer receives the asynchronous message in step 4, the consumer thread acquires the session list information of all the members of the group and performs an update operation at the same time.
Since the session list of the group is updated periodically, the order of the session list of the group can only be guaranteed to a certain extent, and the data of the group session type acquired in step 1 still needs to be reordered, originally, the personal session data and the group session data in step 1 need to be reordered and displayed, so the final ordering is achieved by reordering after the data are merged in step 1.
By the method, the personal conversation chat list needs to be updated every time group sending information is changed into the personal conversation chat list only needs to be updated once every a period of time, so that the times of writing the database are greatly reduced, and the pressure between the system and the database is reduced.
EXAMPLE III
This embodiment corresponds to the first embodiment and the second embodiment, and provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, is capable of implementing the steps included in the session update method. The detailed steps are not repeated here, and refer to the descriptions of the first embodiment and the second embodiment for details.
In summary, the session update method and the storage medium provided by the invention greatly reduce the times of writing the database and effectively relieve the pressure of the system and the database in a manner of regularly and uniformly updating the group session; meanwhile, the session list still has higher timeliness, and the instant updating effect of the group message is not influenced; furthermore, the invention has the advantages of simple implementation mode, little memory resource occupation, high practicability and the like.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (5)

1. A method of session update, comprising:
when a consumer program acquires a group of messages from an MQ, asynchronously storing a group ID of the group of messages into a data structure of a local memory;
scanning the data structure at regular time, sending the scanned group ID to a corresponding consumer program, and clearing the data structure after the scanning is finished;
and after receiving the group ID, the consumer program updates the conversation list sequence of the group member corresponding to the group ID.
2. The method for session update according to claim 1, further comprising:
when a consumer program obtains a group of messages from the MQ, the group of messages is sent to the corresponding group members.
3. The method of claim 1, wherein the asynchronously storing the group IDs of the group of messages in a data structure of a local memory comprises:
and storing the group ID of the group of messages as a key into a map data structure of a local memory through an asynchronous thread.
4. The method for session update according to claim 1, wherein the updating of the session list ordering of the group members corresponding to the group ID specifically comprises:
acquiring a session list of each group member of the group corresponding to the group ID;
and reordering the conversation list of each group member according to the currently acquired personal message and the group ID.
5. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, is adapted to carry out the steps of a method for session update according to any one of claims 1 to 4.
CN202010212698.9A 2020-03-24 2020-03-24 Session updating method and storage medium Active CN111585774B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010212698.9A CN111585774B (en) 2020-03-24 2020-03-24 Session updating method and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010212698.9A CN111585774B (en) 2020-03-24 2020-03-24 Session updating method and storage medium

Publications (2)

Publication Number Publication Date
CN111585774A CN111585774A (en) 2020-08-25
CN111585774B true CN111585774B (en) 2022-02-01

Family

ID=72114850

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010212698.9A Active CN111585774B (en) 2020-03-24 2020-03-24 Session updating method and storage medium

Country Status (1)

Country Link
CN (1) CN111585774B (en)

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1938520B1 (en) * 2005-10-21 2010-08-04 Research In Motion Limited Instant messaging device/server protocol
DK2030394T3 (en) * 2006-06-09 2014-10-27 Tq Lambda Llc PROCEDURE FOR TRANSMISSION OF DATA IN A MOBILE COMMUNICATION SYSTEM
US9935792B2 (en) * 2009-02-24 2018-04-03 Blackberry Limited System and method for switching between conversations in instant messaging applications
CN103259715B (en) * 2013-05-14 2016-11-02 华为软件技术有限公司 A kind of manage the method for multi-conference, Apparatus and system
CN103475585A (en) * 2013-08-23 2013-12-25 天津汉柏汉安信息技术有限公司 Method for refreshing fast forwarding table matching order at fixed time
CN104753985B (en) * 2013-12-30 2018-12-28 腾讯科技(深圳)有限公司 Session list display methods and device
CN105100212A (en) * 2015-06-26 2015-11-25 努比亚技术有限公司 Session message acquisition method and device
CN105119806B (en) * 2015-07-15 2016-11-30 腾讯科技(深圳)有限公司 message updating method and device
CN105306348A (en) * 2015-11-10 2016-02-03 上海斐讯数据通信技术有限公司 Solving method for delayed and leaked messages in group chat and instant messaging tool
CN105472002B (en) * 2015-12-09 2018-11-02 国家电网公司 Based on the session synchronization method copied immediately between clustered node
CN105471716A (en) * 2015-12-17 2016-04-06 网易(杭州)网络有限公司 Method for achieving message synchronization across clients, user equipment and server
CN105933213B (en) * 2016-06-24 2021-01-15 腾讯科技(深圳)有限公司 Chat message processing method, related equipment and system
US9804752B1 (en) * 2016-06-27 2017-10-31 Atlassian Pty Ltd Machine learning method of managing conversations in a messaging interface
CN106506669B (en) * 2016-11-21 2019-12-13 中国移动通信集团江苏有限公司 Method, device and system for processing session information
CN107229526B (en) * 2017-05-17 2019-03-01 腾讯科技(深圳)有限公司 Message treatment method, device, storage medium and computer equipment in group session
CN109408159A (en) * 2017-08-14 2019-03-01 阿里巴巴集团控股有限公司 Interface message is shown and processing method, device and electronic equipment
CN108650168B (en) * 2018-04-09 2021-02-19 网易(杭州)网络有限公司 Method and device for acquiring member data of multi-person session, storage medium and processor
CN110138652B (en) * 2019-05-21 2022-03-25 北京达佳互联信息技术有限公司 Session updating method and device and client device
CN110198263A (en) * 2019-05-29 2019-09-03 北京达佳互联信息技术有限公司 Conversation processing method, device, equipment and system
CN110442461B (en) * 2019-07-11 2022-10-21 福建天泉教育科技有限公司 Message delivery method and storage medium

Also Published As

Publication number Publication date
CN111585774A (en) 2020-08-25

Similar Documents

Publication Publication Date Title
US20210377199A1 (en) Maintaining a message thread with opt-in permanence for entries
US9131054B2 (en) Synchronization in unified messaging systems
US10607165B2 (en) Systems and methods for automatic suggestions in a relationship management system
US10068203B2 (en) Methods and systems for managing to do items or notes or electronic messages
US9160828B2 (en) Managing communications utilizing communication categories
US9432455B2 (en) Synchronizing events between mobile devices and servers
CN103078986B (en) The call-information store method of mobile terminal, device and mobile terminal
US9792015B2 (en) Providing visualizations for conversations
EP1696377A1 (en) Method and system for locating contact information collected from contact sources
EP1696635A2 (en) Method and system for aggregating contact information from multiple contact sources
JP6018204B2 (en) Synchronizing dialog structures in web-based email systems
US11657060B2 (en) Utilizing interactivity signals to generate relationships and promote content
EP2766869A1 (en) Automatically aggregating contact information
US20130339082A1 (en) Contextual information retrieval for groupware integration
CN105227443B (en) Synchronization method, synchronization device and synchronization system for session messages
CN111585774B (en) Session updating method and storage medium
CN109918210B (en) Method and terminal for displaying offline message
US20230229296A1 (en) Notification display in message session
US20180197151A1 (en) Automatically updating an electronic calendar
WO2023284630A1 (en) Emoticon image adding method and apparatus, and device and storage medium
CN111061549A (en) Multitask management method based on android, intelligent terminal and storage medium
JPH06223008A (en) Method and system for more efficient control of response to distribution of signal at inside of data processing system
CN111191134B (en) Intelligent pushing method and terminal
CN105897545A (en) E-mail synchronizing method and device
US12034690B2 (en) Maintaining a message thread with opt-in permanence for entries

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