(iterable: Iterable<ReadonlyArray<RedisArgument>>)
| 378 | |
| 379 | |
| 380 | write(iterable: Iterable<ReadonlyArray<RedisArgument>>) { |
| 381 | if (!this.#socket || !this.#socket.writable) return; |
| 382 | |
| 383 | this.#socket.cork(); |
| 384 | try { |
| 385 | for (const args of iterable) { |
| 386 | for (const toWrite of args) { |
| 387 | this.#socket.write(toWrite); |
| 388 | } |
| 389 | |
| 390 | if (this.#socket.writableNeedDrain) break; |
| 391 | } |
| 392 | } catch (err) { |
| 393 | // net.Socket.write can throw synchronously on a half-closed socket |
| 394 | // (writeAfterFIN -> EPIPE) before the 'close' event fires. The pending |
| 395 | // command has already been moved to #waitingForReply by the queue's |
| 396 | // generator, so the close handler will reject it on reconnect. |
| 397 | if (!err || (err as NodeJS.ErrnoException).code !== 'EPIPE') { |
| 398 | throw err; |
| 399 | } |
| 400 | } finally { |
| 401 | this.#socket.uncork(); |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | async quit<T>(fn: () => Promise<T>): Promise<T> { |
| 406 | if (!this.#isOpen) { |
no outgoing calls