Movatterモバイル変換


[0]ホーム

URL:


CN111585774A - Session updating method and storage medium - Google Patents

Session updating method and storage medium
Download PDF

Info

Publication number
CN111585774A
CN111585774ACN202010212698.9ACN202010212698ACN111585774ACN 111585774 ACN111585774 ACN 111585774ACN 202010212698 ACN202010212698 ACN 202010212698ACN 111585774 ACN111585774 ACN 111585774A
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.)
Granted
Application number
CN202010212698.9A
Other languages
Chinese (zh)
Other versions
CN111585774B (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 LtdfiledCriticalFujian Tianquan Educational Technology Ltd
Priority to CN202010212698.9ApriorityCriticalpatent/CN111585774B/en
Publication of CN111585774ApublicationCriticalpatent/CN111585774A/en
Application grantedgrantedCritical
Publication of CN111585774BpublicationCriticalpatent/CN111585774B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

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)

CN202010212698.9A2020-03-242020-03-24Session updating method and storage mediumActiveCN111585774B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202010212698.9ACN111585774B (en)2020-03-242020-03-24Session updating method and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202010212698.9ACN111585774B (en)2020-03-242020-03-24Session updating method and storage medium

Publications (2)

Publication NumberPublication Date
CN111585774Atrue CN111585774A (en)2020-08-25
CN111585774B CN111585774B (en)2022-02-01

Family

ID=72114850

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202010212698.9AActiveCN111585774B (en)2020-03-242020-03-24Session updating method and storage medium

Country Status (1)

CountryLink
CN (1)CN111585774B (en)

Citations (20)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20100217808A1 (en)*2009-02-242010-08-26Research In Motion LimitedSystem and method for switching between conversations in instant messaging applications
US20110264733A1 (en)*2005-10-212011-10-27Research In Motion LimitedInstant Messaging Device/Server Protocol
US20120243635A1 (en)*2006-06-092012-09-27Lg Electronics Inc.Method of transmitting data in a mobile communication system
CN103259715A (en)*2013-05-142013-08-21华为软件技术有限公司Method, device and system for managing multi-people session
CN103475585A (en)*2013-08-232013-12-25天津汉柏汉安信息技术有限公司Method for refreshing fast forwarding table matching order at fixed time
CN104753985A (en)*2013-12-302015-07-01腾讯科技(深圳)有限公司Session list display method and device
CN105100212A (en)*2015-06-262015-11-25努比亚技术有限公司Session message acquisition method and device
CN105119806A (en)*2015-07-152015-12-02腾讯科技(深圳)有限公司Message updating method and device
CN105306348A (en)*2015-11-102016-02-03上海斐讯数据通信技术有限公司Solving method for delayed and leaked messages in group chat and instant messaging tool
CN105471716A (en)*2015-12-172016-04-06网易(杭州)网络有限公司Method for achieving message synchronization across clients, user equipment and server
CN105472002A (en)*2015-12-092016-04-06国家电网公司Session synchronization method based on instant copying among cluster nodes
CN105933213A (en)*2016-06-242016-09-07腾讯科技(深圳)有限公司Processing method, related equipment and system of chat message
CN106506669A (en)*2016-11-212017-03-15中国移动通信集团江苏有限公司 Method, device and system for processing session information
CN107229526A (en)*2017-05-172017-10-03腾讯科技(深圳)有限公司Message treatment method, device, storage medium and computer equipment in group session
US9804752B1 (en)*2016-06-272017-10-31Atlassian Pty LtdMachine learning method of managing conversations in a messaging interface
CN108650168A (en)*2018-04-092018-10-12网易(杭州)网络有限公司Member data acquisition methods and device, storage medium, the processor of multi-conference
CN109408159A (en)*2017-08-142019-03-01阿里巴巴集团控股有限公司Interface message is shown and processing method, device and electronic equipment
CN110138652A (en)*2019-05-212019-08-16北京达佳互联信息技术有限公司A kind of session updates method, apparatus and client device
CN110198263A (en)*2019-05-292019-09-03北京达佳互联信息技术有限公司Conversation processing method, device, equipment and system
CN110442461A (en)*2019-07-112019-11-12福建天泉教育科技有限公司A kind of message dilivery method, storage medium

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20110264733A1 (en)*2005-10-212011-10-27Research In Motion LimitedInstant Messaging Device/Server Protocol
US20120243635A1 (en)*2006-06-092012-09-27Lg Electronics Inc.Method of transmitting data in a mobile communication system
US20100217808A1 (en)*2009-02-242010-08-26Research In Motion LimitedSystem and method for switching between conversations in instant messaging applications
CN103259715A (en)*2013-05-142013-08-21华为软件技术有限公司Method, device and system for managing multi-people session
CN103475585A (en)*2013-08-232013-12-25天津汉柏汉安信息技术有限公司Method for refreshing fast forwarding table matching order at fixed time
CN104753985A (en)*2013-12-302015-07-01腾讯科技(深圳)有限公司Session list display method and device
CN105100212A (en)*2015-06-262015-11-25努比亚技术有限公司Session message acquisition method and device
CN105119806A (en)*2015-07-152015-12-02腾讯科技(深圳)有限公司Message updating method and device
CN105306348A (en)*2015-11-102016-02-03上海斐讯数据通信技术有限公司Solving method for delayed and leaked messages in group chat and instant messaging tool
CN105472002A (en)*2015-12-092016-04-06国家电网公司Session synchronization method based on instant copying among cluster nodes
CN105471716A (en)*2015-12-172016-04-06网易(杭州)网络有限公司Method for achieving message synchronization across clients, user equipment and server
CN105933213A (en)*2016-06-242016-09-07腾讯科技(深圳)有限公司Processing method, related equipment and system of chat message
US9804752B1 (en)*2016-06-272017-10-31Atlassian Pty LtdMachine learning method of managing conversations in a messaging interface
CN106506669A (en)*2016-11-212017-03-15中国移动通信集团江苏有限公司 Method, device and system for processing session information
CN107229526A (en)*2017-05-172017-10-03腾讯科技(深圳)有限公司Message treatment method, device, storage medium and computer equipment in group session
CN109408159A (en)*2017-08-142019-03-01阿里巴巴集团控股有限公司Interface message is shown and processing method, device and electronic equipment
CN108650168A (en)*2018-04-092018-10-12网易(杭州)网络有限公司Member data acquisition methods and device, storage medium, the processor of multi-conference
CN110138652A (en)*2019-05-212019-08-16北京达佳互联信息技术有限公司A kind of session updates method, apparatus and client device
CN110198263A (en)*2019-05-292019-09-03北京达佳互联信息技术有限公司Conversation processing method, device, equipment and system
CN110442461A (en)*2019-07-112019-11-12福建天泉教育科技有限公司A kind of message dilivery method, storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
田淼: ""分布式异构数据库同步中间件的设计与实现"", 《西安电子科技大学硕士学位论文》*

Also Published As

Publication numberPublication date
CN111585774B (en)2022-02-01

Similar Documents

PublicationPublication DateTitle
US9131054B2 (en)Synchronization in unified messaging systems
US10607165B2 (en)Systems and methods for automatic suggestions in a relationship management system
US9160828B2 (en)Managing communications utilizing communication categories
EP4184889B1 (en)Apparatus and method for maintaining a message thread with opt-in permanence for entries
US8023934B2 (en)Synchronizing communications and data between mobile devices and servers
US8533275B2 (en)Synchronizing conversation structures in web-based email systems
US20080034315A1 (en)Methods and systems for managing to do items or notes or electronic messages
EP1696377A1 (en)Method and system for locating contact information collected from contact sources
US20060195422A1 (en)Method and system for collecting contact information from contact sources and tracking contact sources
US11657060B2 (en)Utilizing interactivity signals to generate relationships and promote content
US20150379131A1 (en)Systems and methods for determining connection strength in a relationship management system
CN106209581A (en)Information processing method, device, server and terminal unit
CN105227443B (en)Synchronization method, synchronization device and synchronization system for session messages
CN111585774B (en)Session updating method and storage medium
CN110659271A (en)Data deletion optimization method and terminal
CN100456751C (en) A kind of instant communication method and system
US20240345713A1 (en)Notification display in message session
CN113709021B (en)Session message generation method and device, computer equipment and storage medium
CN112965835A (en)Method and terminal for efficiently displaying offline message
US12301639B2 (en)Method for sharing electronic content or comments to specific users
CN103532827A (en)System and method for realizing address book function by extending XMPP (Extensible Messaging and Presence Protocol)
CN111191134B (en)Intelligent pushing method and terminal
CN108270912A (en)A kind of information processing method and device based on calendar application
US20070094068A1 (en)Lifecycle objectification of non-activity objects in an activity thread
CN105550072A (en)Data backup method and system

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp