* 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)
| 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 |
no test coverage detected