querysub 0.294.0 → 0.295.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.294.0",
3
+ "version": "0.295.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",
@@ -66,7 +66,8 @@ function onLiveHashChange(liveHash: string, refreshThresholdTime: number) {
66
66
  if (liveHash === curHash) return;
67
67
  let prevHash = curHash;
68
68
  // Don't notify the user right away. Hopefully they refresh naturally, and we never have to notify them at all!
69
- let notifyIntervals = [0.4, 0.75, 1];
69
+ // Also, refresh BEFORE the server dies, not exactly when it is about to die
70
+ let notifyIntervals = [0.4, 0.75, 0.95];
70
71
  console.log(blue(`Client liveHash changed ${liveHash}, prev hash: ${prevHash}`));
71
72
  // If we are replacing an already existing notification, don't show immediately
72
73
  let skipFirst = false;
@@ -359,9 +359,9 @@ type ServiceConfig = ${serviceConfigType}
359
359
  </div>
360
360
  {serviceInfo && (
361
361
  <>
362
- <div title={formatVeryNiceDateTime(serviceInfo.lastLaunchedTime)}>
362
+ {!!serviceInfo.lastLaunchedTime && <div title={formatVeryNiceDateTime(serviceInfo.lastLaunchedTime)}>
363
363
  Uptime: {formatTime(now - serviceInfo.lastLaunchedTime)}
364
- </div>
364
+ </div>}
365
365
  <div>
366
366
  Launches: {serviceInfo.totalTimesLaunched}
367
367
  </div>
@@ -349,6 +349,7 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
349
349
  // REMOVE the nodeId file, so we the node isn't terminated!
350
350
  await fs.promises.unlink(nodeIdPath);
351
351
  try {
352
+ console.log(green(`Triggering rolling update notification to ${nodeId} for ${screenName} at ${new Date().toLocaleString()}`));
352
353
  await triggerRollingUpdate({
353
354
  nodeId,
354
355
  time: rollingFinalTime,
@@ -487,6 +488,13 @@ let lastLaunchedTimePerService = new Map<string, number>();
487
488
 
488
489
  async function quickIsOutdated() {
489
490
  let machineId = getOwnMachineId();
491
+ // If any rolling are ready to restart, we are outdated
492
+ for (let [rollingScreenName, rollingInfo] of rollingKeepScreenAlive) {
493
+ if (rollingInfo.pinnedTime + rollingInfo.pinnedDuration < Date.now()) {
494
+ console.log(red(`Rolling screen ${rollingScreenName} is finished, doing a full resync`));
495
+ return true;
496
+ }
497
+ }
490
498
  let configs = await serviceConfigs.values();
491
499
  let relevantConfigs = configs.filter(config => config.machineIds.includes(machineId)).filter(x => x.parameters.deploy);
492
500
  let screens = await getScreenState();
@@ -508,7 +516,6 @@ async function quickIsOutdated() {
508
516
  if (!fs.existsSync(parameterPath)) return true;
509
517
  let prevParameters = await fs.promises.readFile(parameterPath, "utf8");
510
518
  if (prevParameters !== newParametersString) return true;
511
-
512
519
  }
513
520
  }
514
521
  return false;