querysub 0.724.0 → 0.725.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.724.0",
3
+ "version": "0.725.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -167,11 +167,12 @@ export async function moveLogsToPublic(config: {
167
167
  let groups: typeof initialGroups = [];
168
168
  for (let group of initialGroups) {
169
169
  let currentSize = 0;
170
+ groups.push([]);
170
171
 
171
172
  for (let path of group) {
172
173
  let size = sizeMap.get(path) || 0;
173
174
 
174
- if (groups.length === 0 || currentSize + size > sizeThreshold) {
175
+ if (groups[groups.length - 1].length > 0 && currentSize + size > sizeThreshold) {
175
176
  groups.push([]);
176
177
  currentSize = 0;
177
178
  }
@@ -1,8 +1,14 @@
1
1
  import yargs from "yargs";
2
2
  import { runPromise } from "socket-function/src/runPromise";
3
- import { green, magenta } from "socket-function/src/formatting/logColors";
3
+ import { green, magenta, yellow } from "socket-function/src/formatting/logColors";
4
+ import { formatTime } from "socket-function/src/formatting/format";
5
+ import { delay } from "socket-function/src/batching";
6
+ import { timeInSecond } from "socket-function/src/misc";
4
7
 
5
8
  const REMOTE_TOOLS_FOLDER = "~/querysub-tools";
9
+ const NPM_NOT_YET_VISIBLE_TEXT = "Couldn't find any versions for";
10
+ const INSTALL_MAX_ATTEMPTS = 20;
11
+ const INSTALL_RETRY_DELAY = timeInSecond * 30;
6
12
  const SAFE_VALUE = /^[\w.@:/~-]+$/;
7
13
 
8
14
  let args = yargs(process.argv.slice(2))
@@ -31,7 +37,17 @@ async function main() {
31
37
 
32
38
  await ssh(`mkdir -p ${REMOTE_TOOLS_FOLDER} && (test -d ${folder}/.git || git clone ${repoUrl} ${folder})`);
33
39
  await ssh(`cd ${folder} && git pull --ff-only`);
34
- await ssh(`cd ${folder} && yarn install`);
40
+ for (let attempt = 1; ; attempt++) {
41
+ try {
42
+ await ssh(`cd ${folder} && yarn install`);
43
+ break;
44
+ } catch (e) {
45
+ let stack = String((e as Error).stack || e);
46
+ if (!stack.includes(NPM_NOT_YET_VISIBLE_TEXT) || attempt >= INSTALL_MAX_ATTEMPTS) throw e;
47
+ console.warn(yellow(`yarn install on ${host} failed because npm doesn't show a just-published version yet (attempt ${attempt}/${INSTALL_MAX_ATTEMPTS}), retrying in ${formatTime(INSTALL_RETRY_DELAY)}`));
48
+ await delay(INSTALL_RETRY_DELAY);
49
+ }
50
+ }
35
51
  await ssh(`cd ${folder} && yarn flushlogs`);
36
52
  console.log(green(`Flushed the logs on ${host}`));
37
53
  }