querysub 0.593.0 → 0.594.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.593.0",
3
+ "version": "0.594.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",
@@ -74,7 +74,7 @@
74
74
  "node-forge": "https://github.com/sliftist/forge#e618181b469b07bdc70b968b0391beb8ef5fecd6",
75
75
  "pako": "^2.1.0",
76
76
  "peggy": "^5.0.6",
77
- "sliftutils": "^1.7.72",
77
+ "sliftutils": "^1.7.74",
78
78
  "socket-function": "^1.2.29",
79
79
  "terser": "^5.31.0",
80
80
  "typenode": "^6.6.1",
@@ -72,7 +72,7 @@ function archiveBuilder(bucket: string, overrides: Partial<RemoteConfigBase>) {
72
72
  ]);
73
73
 
74
74
  return createArchives({
75
- version: 16,
75
+ version: 18,
76
76
  sources,
77
77
  });
78
78
  }
@@ -31,13 +31,14 @@ const ARCHIVE_PROPAGATION_TIME = timeInSecond * 5;
31
31
  const MAX_APPLY_TRIES = 10;
32
32
  // Confirms used to be zero-byte files, which the storage layer now treats as deletes, wiping every historical confirmation. Locked files created before this date are assumed confirmed, as anything invalid that old would have already been cleaned up.
33
33
  const ASSUME_CONFIRMED_BEFORE = Date.parse("2026-07-23T00:00:00.000Z");
34
- const CONCURRENT_READ_COUNT = 32;
35
- const CONCURRENT_WRITE_COUNT = 16;
34
+ // NOTE: These values have been increased as our storage servers can handle way more throughput than before because it's using WebSockets.
35
+ const CONCURRENT_READ_COUNT = 128;
36
+ const CONCURRENT_WRITE_COUNT = 128;
36
37
  const CONCURRENT_TRANSACTION_READS = 8;
37
38
 
38
39
  /** Moves by copy-then-delete (IArchives has no move). copyArchiveFile stamps the target with the source's write time, so ordering-by-writeTime survives the move. A missing source means another process already moved it, which is fine. */
39
40
  async function moveArchiveFile(from: IArchives, to: IArchives, path: string): Promise<void> {
40
- let copied = await copyArchiveFile({ from, to, path });
41
+ let copied = await copyArchiveFile({ from, to, path, noFallbacks: true });
41
42
  if (!copied) return;
42
43
  await from.del(path);
43
44
  }
@@ -76,7 +77,8 @@ export function createArchiveLocker2(config: {
76
77
  logNodeStats(`archives|Created TΔ`, formatNumber, 1);
77
78
  },
78
79
  async getValue(key) {
79
- return getArchives(key).get(key);
80
+ // NOTE: I think we wanna not use fallbacks, Because we really want this to be atomic and safe.
81
+ return getArchives(key).get(key, { noFallbacks: true });
80
82
  },
81
83
  async deleteKey(key) {
82
84
  let archives = await getArchives(key);
@@ -6,7 +6,7 @@ import { sort, timeInSecond } from "socket-function/src/misc";
6
6
  import preact from "preact";
7
7
  import { Querysub } from "../../4-querysub/Querysub";
8
8
  import { listServerBuckets, clearServerWriteStats, activateServerBucket, getServerActiveBucket } from "sliftutils/storage/remoteStorage/createArchives";
9
- import type { ServerBucketInfo, BucketDiskInfo, BucketWriteStats, ActiveBucketInfo } from "sliftutils/storage/remoteStorage/storageServerState";
9
+ import type { ServerBucketInfo, BucketWriteStats, ActiveBucketInfo } from "sliftutils/storage/remoteStorage/storageServerState";
10
10
  import type { ArchivesConfig, SyncActivity, RemoteConfig, HostedConfig } from "sliftutils/storage/IArchives";
11
11
  import { parseHostedUrl } from "sliftutils/storage/remoteStorage/remoteConfig";
12
12
  import { UsageBar, getUsageThresholds } from "../../library-components/UsageBar";
@@ -19,6 +19,7 @@ import { Table } from "../../5-diagnostics/Table";
19
19
  import { RouteConfigView } from "./RouteConfigView";
20
20
  import { Tag, SourceTag, getSourceTags } from "./Tag";
21
21
  import { STORAGE_COMMAND_PREFIX } from "../serviceCategories";
22
+ import { BucketDiskInfo } from "sliftutils/storage/remoteStorage/bucketDisk";
22
23
 
23
24
  module.hotreload = true;
24
25
 
@@ -48,7 +48,7 @@ let pendingDiscordNotifications = new Map<string, {
48
48
  errorCount: number;
49
49
  isNew: boolean;
50
50
  }>();
51
- async function getSuppressionEntries(): Promise<SuppressionEntry[]> {
51
+ export async function getSuppressionEntries(): Promise<SuppressionEntry[]> {
52
52
  return await suppression.values();
53
53
  }
54
54
 
@@ -295,14 +295,12 @@ export function getSyncedController<T extends {
295
295
  });
296
296
  // We have to wait until we actually commit before making the call. Otherwise, if this commit is rejected because we need to do synchronized values, we'll call the function twice.
297
297
  let fnc = controller.nodes[nodeId][fncName] as any;
298
- Querysub.onCommitFinished(() => {
299
- // Doesn't on commit finished also implicitly mean we're all synced? Pretty sure that isAll synced is making things break.
300
- //if (Querysub.isAllSynced()) {
298
+ // NOTE: We can't do on commit finish because we later have a trigger on promise finish for our own promise. And if we don't start the promise call until we finish the commit, And we can't finish the commit until we start the promise call, it'll never finish. So... The best we can do is just check for if everything's synced at this current point.
299
+ if (Querysub.isAllSynced()) {
301
300
  void Promise.resolve().then(() => {
302
301
  doPromiseCall();
303
302
  });
304
- //}
305
- });
303
+ }
306
304
  function doPromiseCall() {
307
305
  let promise = fnc(...args) as Promise<unknown>;
308
306
  promiseObjBase.resolve(promise);