fix: 修复 TieredManager 创建 session 时 L1/L2 ID 不一致导致 Redis 写入失败的问题
This commit is contained in:
@@ -47,7 +47,12 @@ func userSessKey(id string) string { return fmt.Sprintf("user:%s:sessions", id)
|
||||
|
||||
// Create 创建新会话。userID 为空表示匿名会话。
|
||||
func (m *RedisManager) Create(ctx context.Context, userID string, config models.SessionConfig) (string, error) {
|
||||
id := uuidNew()
|
||||
return m.CreateWithID(ctx, uuidNew(), userID, config)
|
||||
}
|
||||
|
||||
// CreateWithID 使用指定 ID 创建新会话。
|
||||
// 供 TieredManager 调用,确保 L1/L2 使用相同的 session ID。
|
||||
func (m *RedisManager) CreateWithID(ctx context.Context, id string, userID string, config models.SessionConfig) (string, error) {
|
||||
now := time.Now().UTC()
|
||||
|
||||
pipe := m.rdb.Pipeline()
|
||||
|
||||
Reference in New Issue
Block a user