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

Method reset

packages/client/lib/client/index.ts:1756–1769  ·  view source on GitHub ↗

* Reset the client to its default state (i.e. stop PubSub, stop monitoring, select default DB, etc.)

()

Source from the content-addressed store, hash-verified

1754 * Reset the client to its default state (i.e. stop PubSub, stop monitoring, select default DB, etc.)
1755 */
1756 async reset() {
1757 const chainId = Symbol('Reset Chain'),
1758 promises = [this._self.#queue.reset(chainId)],
1759 selectedDB = this._self.#options?.database ?? 0;
1760 this._self.#credentialsSubscription?.dispose();
1761 this._self.#credentialsSubscription = null;
1762 promises.push(...(await this._self.#handshake(chainId, false)));
1763 this._self.#scheduleWrite();
1764 await Promise.all(promises);
1765 this._self.#selectedDB = selectedDB;
1766 this._self.#monitorCallback = undefined;
1767 this._self.#dirtyWatch = undefined;
1768 this._self.#watchEpoch = undefined;
1769 }
1770
1771 /**
1772 * If the client has state, reset it.

Callers 1

resetIfDirtyMethod · 0.95

Calls 4

disposeMethod · 0.80
#handshakeMethod · 0.80
#scheduleWriteMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected