| 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 { |