tiller-app 1.0.4 → 1.0.5

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.
Files changed (2) hide show
  1. package/bin/tiller.mjs +13 -1
  2. package/package.json +2 -2
package/bin/tiller.mjs CHANGED
@@ -21,8 +21,20 @@ function t3Home() {
21
21
  return path.resolve(raw);
22
22
  }
23
23
 
24
+ const isTransient = (status) => status === 408 || status === 429 || status >= 500;
25
+
24
26
  async function get(url) {
25
- const response = await fetch(url);
27
+ let response;
28
+ for (let attempt = 1; ; attempt++) {
29
+ try {
30
+ response = await fetch(url);
31
+ if (attempt === 4 || !isTransient(response.status)) break;
32
+ await response.body?.cancel();
33
+ } catch (error) {
34
+ if (attempt === 4) throw error;
35
+ }
36
+ await new Promise((resolve) => setTimeout(resolve, 500 * 2 ** (attempt - 1)));
37
+ }
26
38
  if (response.status === 404) {
27
39
  throw new Error(
28
40
  `${url} does not exist yet. If ${version} was just released, try again in a few minutes.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiller-app",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Tiller CLI (Apple Silicon Macs only). Downloads the self-contained executable for this platform from the GitHub Release.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": "github:Antler-Web-Studios/tiller",
@@ -17,6 +17,6 @@
17
17
  "node": ">=20.11"
18
18
  },
19
19
  "t3code": {
20
- "databaseMigration": 80
20
+ "databaseMigration": 85
21
21
  }
22
22
  }