sliftutils 1.7.113 → 1.7.115

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.
@@ -1,4 +1,5 @@
1
1
  import { lazy } from "socket-function/src/caching";
2
+ import { formatDateTimeDetailed } from "socket-function/src/formatting/format";
2
3
  import { runInfinitePoll } from "socket-function/src/batching";
3
4
  import { RemoteConfig, SourceConfig, HostedConfig } from "../IArchives";
4
5
  import { ROUTING_FILE, getConfigVersion, serializeRemoteConfig, parseRoutingData, parseHostedUrl, replaceHostedUrlPort } from "./remoteConfig";
@@ -78,7 +79,7 @@ export function scheduleBoundaryWork(account: string, bucketName: string, routin
78
79
  /** Collects the writes that landed on the previous window's owners just before a boundary, into the store that has just taken over. Who owned what is worked out purely from the config (see previousWindowOwners); this only does the pulling. The config is read off the disk at FIRE time, not captured when the scan was armed - it may have changed in between, and the newest copy is the one the handover actually happened under. */
79
80
  async function runBoundaryScan(account: string, bucketName: string, windowStart: number, offset: number, offsetLabel?: string): Promise<void> {
80
81
  let key = `${account}/${bucketName}`;
81
- let label = `bucket ${key}, window starting ${new Date(windowStart).toISOString()}, offset ${offsetLabel || `${offset / 1000}s`}`;
82
+ let label = `bucket ${key}, window starting ${formatDateTimeDetailed(windowStart)}, offset ${offsetLabel || `${offset / 1000}s`}`;
82
83
  if (boundaryScansRunning.has(key)) {
83
84
  console.log(`Skipping boundary scan (${label}): the previous boundary scan is still running`);
84
85
  return;
@@ -220,7 +221,7 @@ async function maintainIntermediates(): Promise<void> {
220
221
  alreadyCorrect.push(key);
221
222
  continue;
222
223
  }
223
- await writeOwnRoutingConfig({ account, bucketName, storeName: newest.name, current: routing, updated: injected, reason: `we are a deploy successor: writes route to our alternate port ${takeover.altPort} from ${new Date(takeover.start).toISOString()} until our predecessor is killed at ${new Date(takeover.end).toISOString()}` });
224
+ await writeOwnRoutingConfig({ account, bucketName, storeName: newest.name, current: routing, updated: injected, reason: `we are a deploy successor: writes route to our alternate port ${takeover.altPort} from ${formatDateTimeDetailed(takeover.start)} until our predecessor is killed at ${formatDateTimeDetailed(takeover.end)}` });
224
225
  written.push(key);
225
226
  }
226
227
  if (!takeover) return;
@@ -1,4 +1,5 @@
1
1
  import { isNode, sort } from "socket-function/src/misc";
2
+ import { formatDateTimeDetailed } from "socket-function/src/formatting/format";
2
3
  import { delay } from "socket-function/src/batching";
3
4
  import { getSecret } from "../../misc/getSecret";
4
5
  import { IArchives, SourceConfig, RemoteConfig } from "../IArchives";
@@ -92,8 +93,8 @@ export class SourceWrapper {
92
93
  }
93
94
  let [start, end] = this.config.validWindow;
94
95
  if (start !== 0 || end !== Number.MAX_SAFE_INTEGER) {
95
- let startText = start === 0 && "0" || new Date(start).toISOString();
96
- let endText = end === Number.MAX_SAFE_INTEGER && "forever" || new Date(end).toISOString();
96
+ let startText = start === 0 && "0" || formatDateTimeDetailed(start);
97
+ let endText = end === Number.MAX_SAFE_INTEGER && "forever" || formatDateTimeDetailed(end);
97
98
  parts.push(`validWindow [${startText}, ${endText}]`);
98
99
  }
99
100
  return `source ${this.config.url}${parts.length && ` (${parts.join(", ")})` || ""}`;
@@ -121,7 +122,7 @@ export class SourceWrapper {
121
122
  if (this.disposed || this.isConnected()) return;
122
123
  let now = Date.now();
123
124
  if (now >= this.cooldownUntil && this.isConnectionProblemWorthReporting()) {
124
- console.error(`Cannot connect to storage ${this.getDebugName()}; skipping it until ${new Date(now + SOURCE_FAILURE_COOLDOWN).toISOString()} (now ${new Date(now).toISOString()}) unless no other source can serve the request`);
125
+ console.error(`Cannot connect to storage ${this.getDebugName()}; skipping it until ${formatDateTimeDetailed(now + SOURCE_FAILURE_COOLDOWN)} (now ${formatDateTimeDetailed(now)}) unless no other source can serve the request`);
125
126
  // In a browser this is often an untrusted (self-signed) certificate the user hasn't accepted yet - offer them the trust flow (a no-op in Node, and shown at most once per server)
126
127
  showCertTrustModal(this.config.url);
127
128
  }
@@ -5,6 +5,7 @@ import path from "path";
5
5
  import fsp from "fs/promises";
6
6
  import { SocketFunction } from "socket-function/SocketFunction";
7
7
  import { getExternalIP } from "socket-function/src/networking";
8
+ import { formatDateTimeDetailed } from "socket-function/src/formatting/format";
8
9
  import { RequireController } from "socket-function/require/RequireController";
9
10
  import { hostServer } from "../../misc/https/hostServer";
10
11
  import { RemoteStorageController } from "./storageController";
@@ -144,7 +145,7 @@ export async function hostStorageServer(config: HostStorageServerConfig): Promis
144
145
  setAltPort(listeningPort);
145
146
  let listenEnd = getAltPortListenEnd();
146
147
  let timer = setTimeout(() => {
147
- console.log(`Alternate port ${listeningPort} reached its end of life at ${new Date(listenEnd).toISOString()}; it no longer counts as one of our addresses (the socket itself stays bound, as the main-port relay forwards into it)`);
148
+ console.log(`Alternate port ${listeningPort} reached its end of life at ${formatDateTimeDetailed(listenEnd)}; it no longer counts as one of our addresses (the socket itself stays bound, as the main-port relay forwards into it)`);
148
149
  removeExtraListenPort(listeningPort);
149
150
  }, Math.max(0, listenEnd - Date.now()));
150
151
  (timer as { unref?: () => void }).unref?.();
@@ -611,7 +611,7 @@ export class StoreSync {
611
611
  let etaText = "unknown (no bytes transferred yet)";
612
612
  if (bytesPerSecond > 0) {
613
613
  let remainingMs = remainingBytes / bytesPerSecond * 1000;
614
- etaText = `${formatTime(remainingMs)} remaining, completing around ${new Date(Date.now() + remainingMs).toISOString()}`;
614
+ etaText = `${formatTime(remainingMs)} remaining, completing around ${formatDateTimeDetailed(Date.now() + remainingMs)}`;
615
615
  }
616
616
  console.warn(`Delta sync from ${source.getDebugName()} (store ${this.store.folder}) has been running for ${formatTime(elapsed)}: ${doneFiles}/${pending.length} files (${(doneFiles / pending.length * 100).toFixed(1)}%), ${formatNumber(doneBytes)}B/${formatNumber(totalBytes)}B (${(totalBytes && doneBytes / totalBytes * 100 || 100).toFixed(1)}%), ${formatNumber(bytesPerSecond)}B/s. Estimated ${etaText}.`);
617
617
  }, FULL_SYNC_SLOW_ERROR_INTERVAL);
package/yarn.lock CHANGED
@@ -1937,10 +1937,10 @@ slash@^3.0.0:
1937
1937
  resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
1938
1938
  integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
1939
1939
 
1940
- socket-function@^1.2.31:
1941
- version "1.2.31"
1942
- resolved "https://registry.yarnpkg.com/socket-function/-/socket-function-1.2.31.tgz#b9ced45d5c99c310ecbf775d13a731e2aefff8e2"
1943
- integrity sha512-TBAHfSS2iapdweD6sOt2wRvynlrZ9B9EYSYBpm1x84hgbn/xWJRu1yL3e4uHeC07Fun4l8+meUEM6nZkujls0A==
1940
+ socket-function@^1.2.32:
1941
+ version "1.2.32"
1942
+ resolved "https://registry.yarnpkg.com/socket-function/-/socket-function-1.2.32.tgz#9cd6ff3daf2e365bfaef5da0f35271f1c9fd89d3"
1943
+ integrity sha512-d/nuXNXnikLG1eefi099+pG0Lqeibk7Pv92k01YXfTy3W1QjXCef0B9/0hrNJoSyB96r8mtSGk0JdKhCNMqGVQ==
1944
1944
  dependencies:
1945
1945
  "@types/pako" "^2.0.3"
1946
1946
  "@types/ws" "^8.5.3"