querysub 0.600.0 → 0.602.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.600.0",
3
+ "version": "0.602.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",
@@ -25,6 +25,7 @@ import { getGitRefLive, getGitURLLive } from "./git";
25
25
  import { DeployProgress } from "./deployFunctions";
26
26
  import { PromiseObj } from "../promise";
27
27
  import type { FunctionRunnerIndex } from "../4-querysub/FunctionRunnerTracking";
28
+ import { unique } from "../misc";
28
29
 
29
30
  const UPDATE_POLL_INTERVAL = timeInMinute * 15;
30
31
  const DEAD_NODE_COUNT_THRESHOLD = 15;
@@ -314,7 +315,7 @@ async function updateEdgeNodesFile() {
314
315
  }
315
316
 
316
317
  let edgeNodeFiles = await edgeNodeStorage.find("node", { type: "files" });
317
- let edgeNodeNodeIds = edgeNodeFiles.map(getNodeIdFromPath);
318
+ let edgeNodeNodeIds = unique(edgeNodeFiles.map(getNodeIdFromPath));
318
319
 
319
320
  let liveHash = "";
320
321
  if (!noSyncing()) {
@@ -8,8 +8,7 @@ import { InputLabel } from "../../library-components/InputLabel";
8
8
  import { DropdownSelector } from "../../library-components/DropdownSelector";
9
9
  import { closeAllModals } from "../../5-diagnostics/Modal";
10
10
  import { callOpenRouterModel, OpenRouterEffort } from "../../diagnostics/logs/errorNotifications2/openRouterHelper";
11
- import { formatNumber, formatTime } from "socket-function/src/formatting/format";
12
- import { timeInSecond } from "socket-function/src/misc";
11
+ import { formatNumber } from "socket-function/src/formatting/format";
13
12
  import { t } from "../../2-proxy/schema2";
14
13
 
15
14
  module.hotreload = true;
@@ -97,7 +96,6 @@ export class CommitModal extends qreact.Component<{
97
96
  diffLoading: t.boolean(true),
98
97
  summarizing: t.boolean(false),
99
98
  committing: t.boolean(false),
100
- committingStartTime: t.number,
101
99
  error: t.string,
102
100
  lastCost: t.number,
103
101
  });
@@ -174,7 +172,6 @@ export class CommitModal extends qreact.Component<{
174
172
  }
175
173
  Querysub.localCommit(() => {
176
174
  this.state.committing = true;
177
- this.state.committingStartTime = Date.now();
178
175
  this.state.error = "";
179
176
  });
180
177
  try {
@@ -224,7 +221,7 @@ export class CommitModal extends qreact.Component<{
224
221
  <div className={css.hbox(10).flexWrap("wrap").alignItems("flex-end")}>
225
222
  <button
226
223
  className={rowButtonStyle.hsl(45, 80, 85)}
227
- disabled={diffLoading || summarizing || committing}
224
+ disabled={diffLoading || summarizing}
228
225
  title={diff ? extractChangedLines(diff) : ""}
229
226
  onClick={() => void this.doSummarize()}
230
227
  >
@@ -271,10 +268,6 @@ export class CommitModal extends qreact.Component<{
271
268
  ⚠️ {this.state.error}
272
269
  </div>}
273
270
 
274
- {committing && <div className={css.pad2(10).bord2(0, 0, 20).hsl(120, 50, 92).boldStyle}>
275
- ⏳ Running {commitLabel} for {formatTime(Math.max(0, Querysub.nowDelayed(timeInSecond) - this.state.committingStartTime))}…
276
- </div>}
277
-
278
271
  <div className={css.hbox(10)}>
279
272
  <button
280
273
  className={rowButtonStyle.hsl(120, 70, 85)}
@@ -296,11 +296,11 @@ export function getSyncedController<T extends {
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
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()) {
299
+ Querysub.onCommitFinished(() => {
300
300
  void Promise.resolve().then(() => {
301
301
  doPromiseCall();
302
302
  });
303
- }
303
+ });
304
304
  function doPromiseCall() {
305
305
  let promise = fnc(...args) as Promise<unknown>;
306
306
  promiseObjBase.resolve(promise);
@@ -350,6 +350,7 @@ export function getSyncedController<T extends {
350
350
  }
351
351
  currentPromise = currentPromise || promise?.promise;
352
352
  // NOTE: We do somewhat want this if it's a function that's called inside of a render function. However, a lot of the time this is called just as a promise function, in which case we don't want to rerun the event handler.
353
+ // ALSO, We really want to only call the promise on commit finished. Before I thought we could do it if isAll synced, but that doesn't mean we're not going to run again, and we don't want to call the promise function multiple times ever. And if we block here, Then commit finish is blocked so... We can't block committing for synced controller functions.
353
354
  // if (currentPromise) {
354
355
  // Querysub.triggerOnPromiseFinish(currentPromise, {
355
356
  // waitReason: `Waiting for ${fncName} to finish`,