MCPcopy
hub / github.com/redis/ioredis / constructor

Method constructor

lib/DataHandler.ts:44–65  ·  view source on GitHub ↗
(private redis: DataHandledable, parserOptions: ParserOptions)

Source from the content-addressed store, hash-verified

42
43export default class DataHandler {
44 constructor(private redis: DataHandledable, parserOptions: ParserOptions) {
45 const parser = new RedisParser({
46 stringNumbers: parserOptions.stringNumbers,
47 returnBuffers: true,
48 returnError: (err: Error) => {
49 this.returnError(err);
50 },
51 returnFatalError: (err: Error) => {
52 this.returnFatalError(err);
53 },
54 returnReply: (reply: any) => {
55 this.returnReply(reply);
56 },
57 });
58
59 // prependListener ensures the parser receives and processes data before socket timeout checks are performed
60 redis.stream.prependListener("data", (data) => {
61 parser.execute(data);
62 });
63 // prependListener() doesn't enable flowing mode automatically - we need to resume the stream manually
64 redis.stream.resume();
65 }
66
67 private returnFatalError(err: Error) {
68 err.message += ". Please report this.";

Callers

nothing calls this directly

Calls 4

returnErrorMethod · 0.95
returnFatalErrorMethod · 0.95
returnReplyMethod · 0.95
executeMethod · 0.45

Tested by

no test coverage detected