lundi 6 janvier 2020

Some Questions About Message System

enter image description here

As you can see in this pic, i am inplementing a message system. Bacause it is the first time that i design thus a system, i am a little confused. It is not a instant messaging system. What confused me is that i can not ensure the total unread count is always corresponding to the count of the message unread. If a msg received, it is unread indicated by a red round point on the left top corner of the user avatar and on the left zone 我收到的消息 as well. It is the same case if the msg sender send a reply(回复). There is a db table called message_unread to record the unread msg and reply count of each user which looks like this: enter image description here. When a message or reply is received, the field in the table receive unread count will increase by 1. And it will call a API to record its change. Then after the msg or reply is read, it will call a API to descrease the receive unread count. I am a pessimist and not confident about my system, what i am afraid of is that some error may occurs which will lead to the record in db table is not consistent with the unread total count. Then, some cases will happen, eg: After all msg or reply read, the red round point on 我收到的消息 is still there. I am afraid of its occurrence and i do not know how to ensure it is alway consistent.




Aucun commentaire:

Enregistrer un commentaire