feat(chat): implement sequence pre-allocation, versioned sync, and push worker
All checks were successful
Build Backend / build (push) Successful in 4m20s
Build Backend / build-docker (push) Successful in 1m7s

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:
2026-05-17 23:38:04 +08:00
parent f63c795dcb
commit 6bf87fec46
26 changed files with 1450 additions and 82 deletions

View 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
}