Enable redis client to be paused and resumed using underlying stream's pause and resume

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
nodejs, redis, typescript
領域
api, backend

調査の方向性

リンクされているNode.jsのbackpressureガイドを読み、その後、RedisクライアントAPIと、issueで言及されている基盤のstreamから調査を始めてください。pauseとresumeが受信するpubsubデータとTCP接続にどのような影響を与えるべきかを判断し、サンプルクライアントでのclient.pause()とclient.resume()の使用が要求どおりに動作することを確認してください。

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

説明

Issue

node-redis doesn't support the ability to pause and resume the data coming into it. That means if a node process is taking data off redis (for example pubsub) and storing it in another location that has less operations per second the requests from redis will pile up inside nodejs or worse the requests will exceed the limits of the upstream location and requests will begin to fail and drop at that location. Nodejs applications need the ability to manage their own resource consumption. Currently with redis calling callbacks for pubsub events there is no way to backpressure on the redis client and back to the tcp connection. See node guide to backpressure

I am thinking a simple function mirroring the underlying function would be good

const redis = require("redis");
const client = redis.createClient();
client.pause();
client.resume();

I would like to build a nodejs stream on top of redis pubsub and/or redis stream. I think the best way to do this would be to support pause and resume on the client.

The stream would wrap around the client something like

const redis = require("redis");
const redisStream = require("redis-stream");
const { pipeline } = require('stream');
const subscriber = redis.createClient();
subscriber.subscribe("a channel");
const subscriberStream  = redisStream.createReadStream(subscriber, {include_connect: true});

pipeline(subscriberStream, process.stdout)

Environment
  • Node.js Version: 12.16.1
  • Redis Version: 5.0.3
  • Platform: 10.14.6
主要言語
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 を短くまとめたダイジェスト。