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

Method sendCommand

packages/client/lib/client/index.ts:1274–1301  ·  view source on GitHub ↗
(
    args: ReadonlyArray<RedisArgument>,
    options?: CommandOptions
  )

Source from the content-addressed store, hash-verified

1272 }
1273
1274 sendCommand<T = ReplyUnion>(
1275 args: ReadonlyArray<RedisArgument>,
1276 options?: CommandOptions
1277 ): Promise<T> {
1278 return trace(CHANNELS.TRACE_COMMAND,
1279 () => {
1280 if (!this._self.#socket.isOpen) {
1281 return Promise.reject(new ClientClosedError());
1282 } else if (
1283 !this._self.#socket.isReady &&
1284 this._self.#options.disableOfflineQueue
1285 ) {
1286 return Promise.reject(new ClientOfflineError());
1287 }
1288
1289 // Merge global options with provided options
1290 const opts = {
1291 ...this._commandOptions,
1292 ...options,
1293 };
1294
1295 const promise = this._self.#queue.addCommand<T>(args, opts);
1296 this._self.#scheduleWrite();
1297 return promise;
1298 },
1299 () => this._self.#commandTraceContext(args)
1300 );
1301 }
1302
1303 #commandTraceContext(args: ReadonlyArray<RedisArgument>): CommandTraceContext {
1304 return {

Callers 15

RedisClientClass · 0.95
#setPingTimerMethod · 0.95
fnMethod · 0.95
_executeScriptMethod · 0.95
SELECTMethod · 0.95
pool.spec.tsFile · 0.45
WATCHMethod · 0.45
UNWATCHMethod · 0.45
index.spec.tsFile · 0.45
killClientFunction · 0.45

Calls 5

traceFunction · 0.90
#scheduleWriteMethod · 0.80
#commandTraceContextMethod · 0.80
rejectMethod · 0.65
addCommandMethod · 0.45

Tested by 1

killClientFunction · 0.36