MCPcopy
hub / github.com/redis/node-redis / start

Method start

packages/test-utils/lib/proxy/redis-proxy.ts:106–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104 }
105
106 public async start(): Promise<void> {
107 return new Promise((resolve, reject) => {
108 if (this.isRunning) {
109 reject(new Error('Proxy is already running'));
110 return;
111 }
112
113 this.server.listen(this.config.listenPort, this.config.listenHost, () => {
114 this.isRunning = true;
115 this.log(`Proxy listening on ${this.config.listenHost}:${this.config.listenPort}`);
116 this.log(`Forwarding to Redis server at ${this.config.targetHost}:${this.config.targetPort}`);
117 this.emit('listening', this.config.listenHost, this.config.listenPort);
118 resolve();
119 });
120
121 this.server.on('error', (error) => {
122 this.emit('error', error);
123 reject(error);
124 });
125 });
126 }
127
128 public async stop(): Promise<void> {
129 return new Promise((resolve) => {

Callers 2

testWithProxiedClientMethod · 0.95

Calls 1

logMethod · 0.95

Tested by

no test coverage detected