Skip to content

enableOfflineQueue: false 导致 Redis Adapter 订阅失败,所有 WebSocket 广播丢失 #2619

@gufei233

Description

@gufei233

Describe the bug

commit 46206e88redisSubPub 的 pub/sub 客户端添加了 enableOfflineQueue: false。由于 RedisIoAdapter 在启动时立即订阅 Redis,而此时连接尚未就绪,订阅命令直接失败且不会重试。

影响:

  • 所有通过 Redis Emitter 的广播(VISITOR_ONLINEACTIVITY_UPDATE_PRESENCE 等)静默丢失
  • 前端在线人数始终为 0
  • 文章页实时阅读进度推送失效

启动日志:

ERROR  RedisAdapter → psubscribe → "Stream isn't writeable and enableOfflineQueue options is false"
...
ℹ [RedisSubPub] RedisSubPub [pub] ready   ← Adapter 已经失败了

另外 GET /activity/presence 返回以 identity 为 key 的对象,经过 api-client 的 camelcaseKeys 后 key 会被篡改(如 owner_a07f...ownerA07f...),前端按原始 identity 查询时找不到数据。正常情况下 WebSocket 推送能补救,但因上述广播失效,这条路也断了。

Reproduction

  1. 部署 mx-core,观察启动日志中 RedisAdapter 报错先于 RedisSubPub ready 2. 前端在线人数始终为 0,文章页看不到自己的阅读进度

System Info

mx-core: 10.3.2
Node: v22.22.1

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions