How to use the redis-errors.AbortError function in redis-errors

To help you get started, we’ve selected a few redis-errors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github luin / ioredis / lib / cluster / index.ts View on Github external
function tryConnection(random?: boolean, asking?: string) {
      if (_this.status === "end") {
        command.reject(new AbortError("Cluster is ended."));
        return;
      }
      let redis;
      if (_this.status === "ready" || command.name === "cluster") {
        if (node && node.redis) {
          redis = node.redis;
        } else if (
          Command.checkFlag("ENTER_SUBSCRIBER_MODE", command.name) ||
          Command.checkFlag("EXIT_SUBSCRIBER_MODE", command.name)
        ) {
          redis = _this.subscriber.getInstance();
          if (!redis) {
            command.reject(new AbortError("No subscriber for the cluster"));
            return;
          }
        } else {
github luin / ioredis / lib / cluster / index.ts View on Github external
function tryConnection(random?: boolean, asking?: string) {
      if (_this.status === "end") {
        command.reject(new AbortError("Cluster is ended."));
        return;
      }
      let redis;
      if (_this.status === "ready" || command.name === "cluster") {
        if (node && node.redis) {
          redis = node.redis;
        } else if (
          Command.checkFlag("ENTER_SUBSCRIBER_MODE", command.name) ||
          Command.checkFlag("EXIT_SUBSCRIBER_MODE", command.name)
        ) {
          redis = _this.subscriber.getInstance();
          if (!redis) {
            command.reject(new AbortError("No subscriber for the cluster"));
            return;
          }
        } else {
          if (!random) {
            if (typeof targetSlot === "number" && _this.slots[targetSlot]) {
              const nodeKeys = _this.slots[targetSlot];
              if (typeof to === "function") {
                const nodes = nodeKeys.map(function(key) {
                  return _this.connectionPool.getInstanceByKey(key);
                });
                redis = to(nodes, command);
                if (Array.isArray(redis)) {
                  redis = sample(redis);
                }
                if (!redis) {
                  redis = nodes[0];
github luin / ioredis / lib / cluster / index.js View on Github external
function tryConnection(random, asking) {
    if (_this.status === 'end') {
      command.reject(new AbortError('Cluster is ended.'));
      return;
    }
    var redis;
    if (_this.status === 'ready' || (command.name === 'cluster')) {
      if (node && node.redis) {
        redis = node.redis;
      } else if (Command.checkFlag('ENTER_SUBSCRIBER_MODE', command.name) ||
                 Command.checkFlag('EXIT_SUBSCRIBER_MODE', command.name)) {
        redis = _this.subscriber.getInstance();
        if (!redis) {
          command.reject(new AbortError('No subscriber for the cluster'));
          return;
        }
      } else {
        if (!random) {
          if (typeof targetSlot === 'number' && _this.slots[targetSlot]) {
github luin / ioredis / lib / cluster / index.js View on Github external
function tryConnection(random, asking) {
    if (_this.status === 'end') {
      command.reject(new AbortError('Cluster is ended.'));
      return;
    }
    var redis;
    if (_this.status === 'ready' || (command.name === 'cluster')) {
      if (node && node.redis) {
        redis = node.redis;
      } else if (Command.checkFlag('ENTER_SUBSCRIBER_MODE', command.name) ||
                 Command.checkFlag('EXIT_SUBSCRIBER_MODE', command.name)) {
        redis = _this.subscriber.getInstance();
        if (!redis) {
          command.reject(new AbortError('No subscriber for the cluster'));
          return;
        }
      } else {
        if (!random) {
          if (typeof targetSlot === 'number' && _this.slots[targetSlot]) {
            var nodeKeys = _this.slots[targetSlot];
            if (typeof to === 'function') {
              var nodes =
                  nodeKeys
                    .map(function (key) {
                      return _this.connectionPool.nodes.all[key];
                    });
              redis = to(nodes, command);
              if (Array.isArray(redis)) {
                redis = utils.sample(redis);
              }

redis-errors

Error classes used in node_redis

MIT
Latest version published 7 years ago

Package Health Score

65 / 100
Full package analysis