querysub 0.389.0 → 0.391.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.389.0",
3
+ "version": "0.391.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",
@@ -705,6 +705,12 @@ const resyncServicesBase = runInSerial(measureWrap(async function resyncServices
705
705
  let sameParameters = prevParameters === newParametersString;
706
706
  let screenIsRunning = screenStateMap.get(screenName)?.isProcessRunning;
707
707
 
708
+ let nodePathId = folder + SERVICE_NODE_FILE_NAME;
709
+ if (await fsExistsAsync(nodePathId)) {
710
+ let nodeId = await fs.promises.readFile(nodePathId, "utf8");
711
+ machineInfo.services[config.serviceId].nodeId = nodeId;
712
+ }
713
+
708
714
  if (sameParameters && screenIsRunning) {
709
715
  console.log(green(`Verified ${magenta(screenName)} is running`));
710
716
  continue;
@@ -714,12 +720,6 @@ const resyncServicesBase = runInSerial(measureWrap(async function resyncServices
714
720
 
715
721
  await fs.promises.writeFile(parameterPath, newParametersString);
716
722
 
717
- let nodePathId = folder + SERVICE_NODE_FILE_NAME;
718
- if (await fsExistsAsync(nodePathId)) {
719
- let nodeId = await fs.promises.readFile(nodePathId, "utf8");
720
- machineInfo.services[config.serviceId].nodeId = nodeId;
721
- }
722
-
723
723
  await runScreenCommand({
724
724
  screenName,
725
725
  command: config.parameters.command,
@@ -862,7 +862,7 @@ export async function machineApplyMain() {
862
862
  await Querysub.hostService("machine-apply");
863
863
  onServiceConfigChange(resyncServices);
864
864
 
865
- runInfinitePoll(timeInMinute, async () => {
865
+ runInfinitePoll(timeInMinute * 3, async () => {
866
866
  //console.log(magenta(`Quick outdated check at ${new Date().toISOString()}`));
867
867
  // console.log(magenta("Likely outdated, resyncing now"));
868
868
  // NOTE: I'm not sure why we were hesitant to call this. It shouldn't be that slow...
@@ -205,6 +205,8 @@ DO NOT include variables. If something is some dynamic path that includes number
205
205
 
206
206
  The string must be exactly included. You can't stitch together pieces, it will be checked for with .includes() in javascript.
207
207
 
208
+ Also, you will be searching the JSON stringified version of this string. So for example, if there's a ", you're going to have to search with it escaped. So you're going to have to search \\" quote.
209
+
208
210
  Respond with a JSON object with a "pattern" field containing the search string.`;
209
211
 
210
212
  const response = await callOpenRouterJSON<PatternResponse>(openRouterAPIKey, prompt);
@@ -322,41 +324,40 @@ export async function exposeErrorWatchService() {
322
324
  suppressed = true;
323
325
  }
324
326
  }
327
+ //console.log(`Watch loop received error, ${suppressed ? "suppressed" : "not suppressed"}, matched suppression id: ${matchedSuppressionId}: ${error.param0}`);
325
328
 
326
- console.log(`Watch loop received error, ${suppressed ? "suppressed" : "not suppressed"}, matched suppression id: ${matchedSuppressionId}: ${error.param0}`);
329
+ if (suppressed) continue;
327
330
 
328
- if (suppressed && matchedSuppressionId) {
329
- queueDiscordNotification(matchedSuppressionId, 1, false);
330
- } else if (!suppressed) {
331
- if (unmatchedErrors.length > unmatchedIndex) {
332
- unmatchedErrors[unmatchedIndex] = error;
333
- unmatchedIndex = (unmatchedIndex + 1) % MAX_UNMATCHED;
334
- } else {
335
- unmatchedErrors.push(error);
336
- }
331
+ if (unmatchedErrors.length > unmatchedIndex) {
332
+ unmatchedErrors[unmatchedIndex] = error;
333
+ unmatchedIndex = (unmatchedIndex + 1) % MAX_UNMATCHED;
334
+ } else {
335
+ unmatchedErrors.push(error);
336
+ }
337
337
 
338
- if (!matchedSuppressionId) {
339
- const pattern = await generatePatternForError(error);
340
- if (pattern) {
341
- const newEntry: SuppressionEntry = {
342
- id: nextId(),
343
- pattern,
344
- timeout: 0,
345
- createdTime: Date.now(),
346
- lastUpdatedTime: Date.now(),
347
- };
348
-
349
- suppressionCache.push(newEntry);
350
- void suppression.set(newEntry.id, newEntry);
351
- applySuppression(error, newEntry);
352
- queueDiscordNotification(newEntry.id, 1, true);
353
-
354
- void ErrorNotificationService.triggerSuppressionUpdate(newEntry.id);
355
- }
338
+ if (!matchedSuppressionId) {
339
+ const pattern = await generatePatternForError(error);
340
+ if (pattern) {
341
+ const newEntry: SuppressionEntry = {
342
+ id: nextId(),
343
+ pattern,
344
+ timeout: 0,
345
+ createdTime: Date.now(),
346
+ lastUpdatedTime: Date.now(),
347
+ };
348
+
349
+ suppressionCache.push(newEntry);
350
+ void suppression.set(newEntry.id, newEntry);
351
+ applySuppression(error, newEntry);
352
+ queueDiscordNotification(newEntry.id, 1, true);
353
+
354
+ void ErrorNotificationService.triggerSuppressionUpdate(newEntry.id);
356
355
  }
357
-
358
- void ErrorNotificationService.triggerUnmatchedError(error);
356
+ } else {
357
+ queueDiscordNotification(matchedSuppressionId, 1, false);
359
358
  }
359
+
360
+ void ErrorNotificationService.triggerUnmatchedError(error);
360
361
  } catch (error) {
361
362
  console.warn("Error in watch loop:", error);
362
363
  }
@@ -23,9 +23,7 @@ IMPORTANT! Now I am properly calling shutdown, so none of the streamed logs shou
23
23
  //todonext
24
24
 
25
25
 
26
- 2) One of the cyoa instances... does not exist? I think the tmux screen might be in a bad state?
27
- - Maybe... our collection has... duplicates, and/or, references something broken? Because... tmux ls looks fine to me...
28
- - In the deployed machines list, we should really show the screen name. Don't we know the screen name? Isn't that the only way we know it's deployed to that machine?
26
+
29
27
  3) "guessed node id" is never working? At least, on the machine's page it is ALWAYS empty, even though it should be almost always detected...
30
28
 
31
29
  4) Verify it works again, when we have multiple servers