feat: add redis cache and fanout support

This commit is contained in:
richjohnrambo
2026-08-25 20:54:03 +08:00
parent 07376c70e3
commit f900a08a01
68 changed files with 3949 additions and 5696 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ import (
// presParams defines parameters for creating a presence notification.
type presParams struct {
userAgent string
seqID int
seqID int64
delID int
delSeq []MsgRange
@@ -483,7 +483,7 @@ func (t *Topic) presSubsOffline(what string, params *presParams,
// Publish {info what=read|recv|kp} to topic subscribers's sessions currently offline in the topic,
// on subscriber's 'me'. Group and P2P.
func (t *Topic) infoSubsOffline(from types.Uid, what string, seq int, skipSid string) {
func (t *Topic) infoSubsOffline(from types.Uid, what string, seq int64, skipSid string) {
user := from.UserId()
for uid, pud := range t.perUser {
@@ -509,7 +509,7 @@ func (t *Topic) infoSubsOffline(from types.Uid, what string, seq int, skipSid st
}
// Publish {info what=call} to topic subscribers's sessions on subscriber's 'me'.
func (t *Topic) infoCallSubsOffline(from string, target types.Uid, event string, seq int,
func (t *Topic) infoCallSubsOffline(from string, target types.Uid, event string, seq int64,
sdp json.RawMessage, skipSid string, offlineOnly bool) {
if target.IsZero() {
logs.Err.Printf("callSubs could not find target: topic %s - from %s", t.name, from)
@@ -672,9 +672,9 @@ func presSingleUserOfflineOffline(tenantID types.TenantID, uid types.Uid, origin
// Let other sessions of a given user know what messages are now received/read.
// If both 'read' and 'recv' != 0 then 'read' takes precedence over 'recv'.
// Cases U
func (t *Topic) presPubMessageCount(uid types.Uid, mode types.AccessMode, read, recv int, skip string) {
func (t *Topic) presPubMessageCount(uid types.Uid, mode types.AccessMode, read, recv int64, skip string) {
var what string
var seq int
var seq int64
if read > 0 {
what = "read"
seq = read