Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xapp/dynamo-service

Package Overview
Dependencies
Maintainers
6
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xapp/dynamo-service - npm Package Compare versions

Comparing version 0.0.74 to 0.0.75

xapp-dynamo-service-0.0.74.tgz

47

dist/utils/Backoff.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -31,22 +23,25 @@ const Sleep_1 = require("./Sleep");

function backOff(props = {}, run, ...args) {
return __awaiter(this, void 0, void 0, function* () {
let retries = 0;
let sleepTime = 0;
const realProps = Object.assign({ shouldRetry: alwaysTrue, retryAttempts: exports.DEFAULT_RETRY_ATTEMPTS, failOffStrategy: exponentialTime() }, props);
const { retryAttempts, shouldRetry, failOffStrategy } = realProps;
while (true) {
try {
return yield run(...args, retries);
const realProps = Object.assign({ shouldRetry: alwaysTrue, retryAttempts: exports.DEFAULT_RETRY_ATTEMPTS, failOffStrategy: exponentialTime() }, props);
const { retryAttempts, shouldRetry, failOffStrategy } = realProps;
const attempt = (attempts = 0) => {
let promise;
try {
promise = Promise.resolve(run(...args, attempts));
}
catch (e) {
promise = Promise.reject(e);
}
return promise
.catch((e) => {
if (attempts < retryAttempts && shouldRetry(e)) {
const sleepTime = failOffStrategy(attempts);
return Sleep_1.sleep(sleepTime)
.then(() => attempt(++attempts));
}
catch (e) {
if (++retries < retryAttempts && shouldRetry(e)) {
yield Sleep_1.sleep(sleepTime);
sleepTime = failOffStrategy(retries);
}
else {
throw e;
}
else {
return Promise.reject(e);
}
}
});
});
};
return attempt(1);
}

@@ -53,0 +48,0 @@ exports.backOff = backOff;

{
"name": "@xapp/dynamo-service",
"version": "0.0.74",
"version": "0.0.75",
"description": "A dynamo help class which will help maintain data integrity.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc