MCPcopy
hub / github.com/redis/ioredis / flushQueue

Method flushQueue

lib/Redis.ts:927–951  ·  view source on GitHub ↗

* Flush offline queue and command queue with error. * * @param error The error object to send to the commands * @param options options

(error: Error, options?: FlushQueueOptions)

Source from the content-addressed store, hash-verified

925 * @param options options
926 */
927 private flushQueue(error: Error, options?: FlushQueueOptions) {
928 options = defaults({}, options, {
929 offlineQueue: true,
930 commandQueue: true,
931 });
932
933 let item;
934 if (options.offlineQueue) {
935 while ((item = this.offlineQueue.shift())) {
936 item.command.reject(error);
937 }
938 }
939
940 if (options.commandQueue) {
941 if (this.commandQueue.length > 0) {
942 if (this.stream) {
943 this.stream.removeAllListeners("data");
944 }
945
946 while ((item = this.commandQueue.shift())) {
947 item.command.reject(error);
948 }
949 }
950 }
951 }
952
953 /**
954 * Check whether Redis has finished loading the persistent data and is able to

Callers 2

recoverFromFatalErrorMethod · 0.95
_connectMethod · 0.45

Calls 2

defaultsFunction · 0.85
rejectMethod · 0.80

Tested by

no test coverage detected