fix: align group management APIs

This commit is contained in:
richjohnrambo
2026-09-13 16:03:55 +08:00
parent f1279ac607
commit a9afc6ff6a
34 changed files with 1381 additions and 639 deletions
+6 -3
View File
@@ -146,6 +146,8 @@ var globals struct {
sessionStore *SessionStore
// Cluster data.
cluster *Cluster
// Unique node ID used by Redis realtime fanout when native clustering is disabled.
nodeID string
// gRPC server.
grpcServer *grpc.Server
// Plugins.
@@ -346,6 +348,8 @@ type configType struct {
ExpvarPath string `json:"expvar"`
// URL path for internal server status. Disabled if the path is blank.
ServerStatusPath string `json:"server_status"`
// Unique IM node ID for Redis realtime fanout. Defaults to IM_NODE_ID or HOSTNAME.
NodeID string `json:"node_id"`
// Take IP address of the client from HTTP header 'X-Forwarded-For'.
// Useful when tinode is behind a proxy. If missing, fallback to default RemoteAddr.
UseXForwardedFor bool `json:"use_x_forwarded_for"`
@@ -466,6 +470,7 @@ func main() {
// Initialize cluster and receive calculated workerId.
// Cluster won't be started here yet.
workerId := clusterInit(config.Cluster, clusterSelf)
globals.nodeID = resolveIMNodeID(config.NodeID)
if *pprofFile != "" {
*pprofFile = toAbsolutePath(curwd, *pprofFile)
@@ -740,14 +745,12 @@ func main() {
globals.sessionStore = NewSessionStore(idleSessionTimeout + 15*time.Second)
// The hub (the main message router)
globals.hub = newHub()
startRedisGroupFanout(context.Background())
startRedisRealtimeFanout(context.Background())
startKafkaAdminCommandConsumer()
startKafkaConfigEventConsumer()
startKafkaCacheInvalidateConsumer()
startKafkaMessagePersistConsumer()
startKafkaDeadLetterConsumer()
stopExternalBusinessEvents := startIMExternalBusinessEventPoller()
defer stopExternalBusinessEvents()
// Start accepting cluster traffic.
if globals.cluster != nil {