Sha256: 217341909209a989425ff380458e16d667c3da98df660749f5ffe5e2ce2e8f96

Contents?: true

Size: 834 Bytes

Versions: 17

Compression:

Stored size: 834 Bytes

Contents

var log = require('../logger').create('launcher');

var RetryLauncher = function(retryLimit) {
  var self = this;

  this._retryLimit = retryLimit;

  this.on('done', function() {
    if (!self.error) {
      return;
    }

    if (self._retryLimit > 0) {
      var attempt = retryLimit - self._retryLimit + 1;
      log.info('Trying to start %s again (%d/%d).', self.name, attempt, retryLimit);
      self.restart();
      self._retryLimit--;
    } else if (self._retryLimit === 0) {
      log.error('%s failed %d times (%s). Giving up.', self.name, retryLimit, self.error);
    } else {
      log.debug('%s failed (%s). Not restarting.', self.name, self.error);
    }
  });
};

RetryLauncher.decoratorFactory = function() {
  return function(launcher) {
    RetryLauncher.call(launcher, 2);
  };
};

module.exports = RetryLauncher;

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.4.1 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.4.0 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.3.0 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.2.1 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.2.0 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.1.0 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.0.8 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.0.7 jasmine/node_modules/karma/lib/launchers/retry.js
hooch-0.0.6 jasmine/node_modules/karma/lib/launchers/retry.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/lib/launchers/retry.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/lib/launchers/retry.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/lib/launchers/retry.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/lib/launchers/retry.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/lib/launchers/retry.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/lib/launchers/retry.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/lib/launchers/retry.js