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

Function usersRegisterUser

server/user.go:829–846  ·  view source on GitHub ↗

Start tracking a single user. Used for cache management. 'add' increments/decrements user's count of subscribed topics.

(uid types.Uid, add bool)

Source from the content-addressed store, hash-verified

827// Start tracking a single user. Used for cache management.
828// 'add' increments/decrements user's count of subscribed topics.
829func usersRegisterUser(uid types.Uid, add bool) {
830 if globals.usersUpdate == nil {
831 return
832 }
833
834 upd := &UserCacheReq{UserIdList: make([]types.Uid, 1), Inc: add}
835 upd.UserIdList[0] = uid
836
837 if globals.cluster.isRemoteTopic(uid.UserId()) {
838 // Send request to remote node which owns the user.
839 globals.cluster.routeUserReq(upd)
840 } else {
841 select {
842 case globals.usersUpdate <- upd:
843 default:
844 }
845 }
846}
847
848// Stop tracking user and remove him from cache.
849func usersRemoveUser(uid types.Uid) {

Callers 3

thisUserSubMethod · 0.85
anotherUserSubMethod · 0.85
evictUserMethod · 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…