feat(chat): implement sequence pre-allocation, versioned sync, and push worker
Introduce several performance and synchronization enhancements: - Implement `SeqBufferManager` to allow sequence number pre-allocation via Redis Lua scripts, reducing atomic increment overhead. - Add `PushWorker` to handle asynchronous message pushing using Redis Streams. - Implement incremental conversation synchronization via `ConversationVersionLog` to allow clients to fetch only recent changes. - Add support for Gzip compression in WebSocket communications to reduce bandwidth usage. - Update dependency injection and configuration to support these new components.
This commit is contained in:
13
internal/config/push_worker.go
Normal file
13
internal/config/push_worker.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package config
|
||||
|
||||
// PushWorkerConfig 推送 Worker 配置(Redis Stream 异步推送)
|
||||
type PushWorkerConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
Stream string `mapstructure:"stream"` // Redis Stream 名称,默认 "msg_push"
|
||||
Group string `mapstructure:"group"` // Consumer Group 名称,默认 "push_worker"
|
||||
BatchSize int `mapstructure:"batch_size"` // XREADGROUP 每次读取条数,默认 50
|
||||
PollTimeoutMs int `mapstructure:"poll_timeout_ms"` // XREADGROUP BLOCK 超时 ms,默认 2000
|
||||
MaxRetries int `mapstructure:"max_retries"` // 消息最大重试次数,默认 3
|
||||
MaxStreamLen int64 `mapstructure:"max_stream_len"` // Stream MAXLEN,默认 100000
|
||||
IdleTimeoutMs int64 `mapstructure:"idle_timeout_ms"` // XPENDING 空闲超时 ms,默认 30000
|
||||
}
|
||||
Reference in New Issue
Block a user