@daimo/pay-common 1.19.6 → 1.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,5 @@ export * from "./daimoPay";
4
4
  export * from "./debug";
5
5
  export * from "./format";
6
6
  export * from "./primitiveTypes";
7
- export * from "./retryBackoff";
8
7
  export * from "./token";
9
8
  export * from "./try";
package/dist/index.js CHANGED
@@ -20,7 +20,6 @@ __exportStar(require("./daimoPay"), exports);
20
20
  __exportStar(require("./debug"), exports);
21
21
  __exportStar(require("./format"), exports);
22
22
  __exportStar(require("./primitiveTypes"), exports);
23
- __exportStar(require("./retryBackoff"), exports);
24
23
  __exportStar(require("./token"), exports);
25
24
  __exportStar(require("./try"), exports);
26
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,mDAAiC;AACjC,iDAA+B;AAC/B,0CAAwB;AACxB,wCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,mDAAiC;AACjC,0CAAwB;AACxB,wCAAsB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daimo/pay-common",
3
- "version": "1.19.6",
3
+ "version": "1.19.7",
4
4
  "description": "Daimo Pay shared types and utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -4,6 +4,5 @@ export * from "./daimoPay";
4
4
  export * from "./debug";
5
5
  export * from "./format";
6
6
  export * from "./primitiveTypes";
7
- export * from "./retryBackoff";
8
7
  export * from "./token";
9
8
  export * from "./try";
@@ -1,30 +0,0 @@
1
- /**
2
- * Retries a function up to a maximum number of times, with exponential backoff.
3
- * Current settings, max total wait time is ~10 seconds.
4
- */
5
- export async function retryBackoff<T>(
6
- name: string,
7
- fn: () => Promise<T>,
8
- maxRetries = 5,
9
- backoffFn: (i: number) => number = (i) => Math.min(2000, 250 * 2 ** i),
10
- ): Promise<T> {
11
- for (let i = 1; ; i++) {
12
- try {
13
- return await fn();
14
- } catch (e) {
15
- if (i <= maxRetries) {
16
- const sleepMs = backoffFn(i);
17
- console.error(
18
- `[RETRY] ${name} sleeping ${sleepMs}ms after try ${i}, error:`,
19
- e,
20
- );
21
- await new Promise((r) => setTimeout(r, sleepMs));
22
- } else {
23
- console.warn(`[RETRY] ${name} QUITTING after try ${i}, error: ${e}`);
24
- break;
25
- }
26
- }
27
- }
28
- // TODO: add performance logging
29
- throw new Error(`too many retries: ${name}`);
30
- }