MCPcopy
hub / github.com/tinode/chat / usersUpdateUnread

Function usersUpdateUnread

server/user.go:810–825  ·  view source on GitHub ↗
(uid types.Uid, val int, inc bool)

Source from the content-addressed store, hash-verified

808}
809
810func usersUpdateUnread(uid types.Uid, val int, inc bool) {
811 if globals.usersUpdate == nil || (val == 0 && inc) {
812 return
813 }
814
815 upd := &UserCacheReq{UserId: uid, Unread: val, Inc: inc}
816 if globals.cluster.isRemoteTopic(uid.UserId()) {
817 // Send request to remote node which owns the user.
818 globals.cluster.routeUserReq(upd)
819 } else {
820 select {
821 case globals.usersUpdate <- upd:
822 default:
823 }
824 }
825}
826
827// Start tracking a single user. Used for cache management.
828// 'add' increments/decrements user's count of subscribed topics.

Callers 6

handleNoteBroadcastMethod · 0.85
thisUserSubMethod · 0.85
anotherUserSubMethod · 0.85
replyDelMsgMethod · 0.85
replyDelSubMethod · 0.85
replyLeaveUnsubMethod · 0.85

Calls 3

isRemoteTopicMethod · 0.80
UserIdMethod · 0.80
routeUserReqMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…