@promise-watch/core
Advanced tools
Comparing version 0.0.13 to 0.0.14
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -15,7 +15,10 @@ "use strict"; | ||
notifiers = (_a = options.notifiers) !== null && _a !== void 0 ? _a : notifiers; | ||
let passed = false; | ||
const runAttempt = async () => { | ||
await run(); | ||
await (0, send_notifications_1.sendSuccessNotifications)(name, notifiers); | ||
passed = true; | ||
if (options.logSuccess) | ||
console.log(new Date(), name, "SUCCESS"); | ||
}; | ||
let passed = false; | ||
await runAttempt() | ||
@@ -26,3 +29,5 @@ .catch(() => { | ||
}) | ||
.catch(err => (0, send_notifications_1.sendErrorNotifications)(name, err.message, notifiers)); | ||
.catch(err => { | ||
return (0, send_notifications_1.sendErrorNotifications)(name, err.message, notifiers); | ||
}); | ||
if (alive) { | ||
@@ -34,3 +39,3 @@ if (passed) { | ||
} | ||
if (!options.tryAgainImmediately) { | ||
if (options.retryImmediatelyAfterFail !== true) { | ||
await (0, sleep_1.sleep)(options.interval * 1000); | ||
@@ -37,0 +42,0 @@ } |
@@ -9,3 +9,4 @@ export declare type RunPage = { | ||
notifiers?: Notifier[]; | ||
tryAgainImmediately?: boolean; | ||
logSuccess?: boolean; | ||
retryImmediatelyAfterFail?: boolean; | ||
}; | ||
@@ -12,0 +13,0 @@ export declare type ExecuteOptions = { |
{ | ||
"name": "@promise-watch/core", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "author": "Jason Raimondi <jason@raimondi.us> (https://jasonraimondi.com)", |
@@ -15,9 +15,11 @@ import { Notifier, RunPage } from "./types"; | ||
let passed = false; | ||
const runAttempt = async () => { | ||
await run(); | ||
await sendSuccessNotifications(name, notifiers); | ||
passed = true; | ||
if (options.logSuccess) console.log(new Date(), name, "SUCCESS"); | ||
}; | ||
let passed = false; | ||
// try runs twice before sending an error notification | ||
@@ -29,8 +31,6 @@ await runAttempt() | ||
}) | ||
.catch(err => sendErrorNotifications(name, err.message, notifiers)); | ||
.catch(err => { | ||
return sendErrorNotifications(name, err.message, notifiers) | ||
}); | ||
// passed wait | ||
// failed tryAgainImmediately: false wait | ||
// failed tryAgainImmediately: true no-wait | ||
if (alive) { | ||
@@ -43,3 +43,3 @@ if (passed) { | ||
if (!options.tryAgainImmediately) { | ||
if (options.retryImmediatelyAfterFail !== true) { | ||
await sleep(options.interval * 1000); | ||
@@ -46,0 +46,0 @@ } |
@@ -10,3 +10,4 @@ export type RunPage = { | ||
notifiers?: Notifier[]; | ||
tryAgainImmediately?: boolean; | ||
logSuccess?: boolean; | ||
retryImmediatelyAfterFail?: boolean; | ||
}; | ||
@@ -13,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35524
611