source: trip-planner-front/node_modules/karma/lib/launchers/retry.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 840 bytes
RevLine 
[6a3a178]1const log = require('../logger').create('launcher')
2
3function RetryLauncher (retryLimit) {
4 this._retryLimit = retryLimit
5
6 this.on('done', () => {
7 if (!this.error) {
8 return
9 }
10
11 if (this._retryLimit > 0) {
12 log.info(`Trying to start ${this.name} again (${retryLimit - this._retryLimit + 1}/${retryLimit}).`)
13 this.restart()
14 this._retryLimit--
15 } else if (this._retryLimit === 0) {
16 log.error(`${this.name} failed ${retryLimit} times (${this.error}). Giving up.`)
17 } else {
18 log.debug(`${this.name} failed (${this.error}). Not restarting.`)
19 }
20 })
21}
22
23RetryLauncher.decoratorFactory = function (retryLimit) {
24 return function (launcher) {
25 RetryLauncher.call(launcher, retryLimit)
26 }
27}
28
29RetryLauncher.decoratorFactory.$inject = ['config.retryLimit']
30
31module.exports = RetryLauncher
Note: See TracBrowser for help on using the repository browser.