adolph_1 2019-10-12 13:51 采纳率: 16.7%
浏览 2856

nodejs连接redis,经常掉线,然后重新连接,报错:Redis connection lost and command aborted. It might have been processed.

UnhandledPromiseRejectionWarning: AbortError: Redis connection lost and command aborted. It might have been processed.
    at RedisClient.flush_and_error (C:\workspace\MainData\node_modules\redis\index.js:362:23)
    at RedisClient.connection_gone (C:\workspace\MainData\node_modules\redis\index.js:664:14)
    at RedisClient.on_error (C:\workspace\MainData\node_modules\redis\index.js:410:10)
    at Socket.<anonymous> (C:\workspace\MainData\node_modules\redis\index.js:279:14)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:8088) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:8088) UnhandledPromiseRejectionWarning: AbortError: Redis connection lost and command aborted. It might have been processed.
    at RedisClient.flush_and_error (C:\workspace\MainData\node_modules\redis\index.js:362:23)
    at RedisClient.connection_gone (C:\workspace\MainData\node_modules\redis\index.js:664:14)
    at RedisClient.on_error (C:\workspace\MainData\node_modules\redis\index.js:410:10)
    at Socket.<anonymous> (C:\workspace\MainData\node_modules\redis\index.js:279:14)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:8088) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
  • 写回答

2条回答 默认 最新

  • @baby张 2019-10-12 14:56
    关注

    可以在node里用websocket 链接redis频道,并监听,里面写个轮循,断了就去重新链接,我的这个博客看下(websocket(Redis,node, react 三方处理)),希望对你有帮助。

    https://blog.csdn.net/weixin_43648947/article/details/100009465

    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵