Start tracking a single user. Used for cache management. 'add' increments/decrements user's count of subscribed topics.
(uid types.Uid, add bool)
| 827 | // Start tracking a single user. Used for cache management. |
| 828 | // 'add' increments/decrements user's count of subscribed topics. |
| 829 | func 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. |
| 849 | func usersRemoveUser(uid types.Uid) { |
no test coverage detected
searching dependent graphs…