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
+12 -12
View File
@@ -777,7 +777,7 @@ func TestHandleBroadcastDataDuplicateClientMessage(t *testing.T) {
if !ok {
t.Fatalf("User1: expected ctrl params map, received %#v", ack.Ctrl.Params)
}
if seq, ok := params["seq"].(int); !ok || seq != 4 {
if seq, ok := params["seq"].(int64); !ok || seq != 4 {
t.Errorf("User1: expected duplicate ack seq 4, received %#v", params["seq"])
}
if len(helper.results[1].messages) != 0 {
@@ -949,7 +949,7 @@ func TestHandleBroadcastDataInactiveTopic(t *testing.T) {
func TestHandleBroadcastInfoP2P(t *testing.T) {
topicName := "usrP2P"
numUsers := 2
readId := 8
readId := int64(8)
helper := TopicTestHelper{}
helper.setUp(t, numUsers, types.TopicCatP2P, topicName, true)
defer helper.tearDown()
@@ -1065,7 +1065,7 @@ func TestHandleBroadcastInfoBogusNotification(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 11
readId := int64(11)
from := helper.uids[0]
to := helper.uids[1]
@@ -1113,7 +1113,7 @@ func TestHandleBroadcastInfoFilterOutRecvWithoutRPermission(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 8
readId := int64(8)
from := helper.uids[0]
to := helper.uids[1]
@@ -1166,7 +1166,7 @@ func TestHandleBroadcastInfoFilterOutKpWithoutWPermission(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 8
readId := int64(8)
from := helper.uids[0]
to := helper.uids[1]
@@ -1219,7 +1219,7 @@ func TestHandleBroadcastInfoDuplicatedRead(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 8
readId := int64(8)
from := helper.uids[0]
to := helper.uids[1]
@@ -1272,7 +1272,7 @@ func TestHandleBroadcastInfoDbError(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 8
readId := int64(8)
from := helper.uids[0]
to := helper.uids[1]
@@ -1326,7 +1326,7 @@ func TestHandleBroadcastInfoInvalidChannelAccess(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 8
readId := int64(8)
from := helper.uids[0]
for i := 1; i < numUsers; i++ {
uid := helper.uids[i]
@@ -1380,7 +1380,7 @@ func TestHandleBroadcastInfoChannelProcessing(t *testing.T) {
// Pretend we have 10 messages.
helper.topic.lastID = 10
// uid1 notifies uid2 that uid1 has read messages up to seqid 11.
readId := 8
readId := int64(8)
from := helper.uids[0]
for i := 1; i < numUsers; i++ {
uid := helper.uids[i]
@@ -3222,7 +3222,7 @@ func TestHandleBroadcastInfoChannelWithMultipleReaders(t *testing.T) {
defer helper.tearDown()
helper.topic.lastID = 15
readId := 12
readId := int64(12)
from := helper.uids[0]
// Set up multiple channel readers
@@ -3606,8 +3606,8 @@ func TestReplyDelMsgUpdatesUnreadCounters(t *testing.T) {
func TestCalculateUnreadInRanges(t *testing.T) {
tests := []struct {
name string
readID int
lastID int
readID int64
lastID int64
ranges []types.Range
expected int
}{