Outcome | percentage |
---|---|
Succeeds on 1st retry | 76.3% |
Succeeds on 2nd retry | 2.8% |
Succeeds on 3rd retry | 1.3% |
Succeeds on 4th retry | 1.0% |
Succeeds on 5th retry | 1.0% |
Dead-letter | 17.6% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// scenarioRunner.js | |
async function scenarioRunner(scenarioIds, runScenario) { | |
try { | |
await Promise.all(scenarioIds.map(runScenario)); | |
} catch (error) { | |
console.log("A scenario failed", error); | |
} | |
} | |
// scenarioRunner.spec.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Saga() | |
.do(lockResource) | |
.withCompensatingAction(unlockResource) | |
.then(processPayment) | |
.withCompensatingAction(cancelPayment) | |
.then(addBillingItem); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compensatingActions = []; | |
try { | |
await lockResource(); | |
compensatingActions.push(unlockResource); | |
const receipt = await processPayment(); | |
compensatingActions.push(() => cancelPayment(receipt)); | |
await addBillingItem(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let finalError | |
try { | |
throw "oups!"; | |
} catch(error) { | |
throw "so clumsy..."; | |
} catch(error) { | |
finalError = error | |
} | |
console.log("hello!"); | |
if (finalError) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
db.connect(); | |
const data = db.getData(); | |
return status(200).data(data); | |
} catch(error) { | |
return status(500).error(error); | |
} finally { | |
db.disconnect(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
try { | |
throw "oups!"; | |
} catch(error) { | |
return "early"; | |
} finally { | |
console.log("hello!"); | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
try { | |
return "early"; | |
} finally { | |
console.log("hello!"); | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
throw "oups!"; | |
} catch(error) { | |
throw "so clumsy..."; | |
} finally { | |
console.log("hello!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
throw "oups!"; | |
} finally { | |
console.log("hello!"); | |
} |
NewerOlder