client.flush() disallows the 'end' event to be emitted

オープン
#1,565 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
node.js, redis
領域
api

調査の方向性

redis/lib/extendedApi.js の RedisClient.prototype.end から始め、redis/index.js の 225 行目付近にアタッチされている 'close' listener と比較してください。client.flush() のパスを追跡し、ストリームを閉じてもクライアントの 'end' イベントが引き続き発行され、必要なエラー処理が抑制されないことを確認してください。

索引モデルが issue の本文から書いたものです。

説明

Bug

Using the latest redis 3.0.2.

Iif someone calls client.flush() no further events are emitted by the Redis client. At least the 'end' event should be emitted in order to notify users that the socket has been closed.
The problem lies in redis/lib/extendedApi.js:

RedisClient.prototype.end = function (flush) {
    ...
    this.stream.removeAllListeners();
    this.stream.on('error', noop);
    this.connected = false;
    this.ready = false;
    this.closing = true;
    return this.stream.destroySoon();
};

Not all socket listeners should be removed. Either the 'close' listener attached in line 225 of redis/index.js should be preserved/restored or an ad-hoc listener emitting 'end' should be added after the

this.stream.removeAllListeners();

line above.

主要言語
TypeScript
スター
17.6k
フォーク
2k
平均マージ
1日 22時間
マージ済み PR(30日)
62

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

redis/node-redis のほかの issue

redis/node-redis の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。