querysub 0.387.0 → 0.389.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.387.0",
3
+ "version": "0.389.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",
@@ -863,18 +863,18 @@ export async function machineApplyMain() {
863
863
  onServiceConfigChange(resyncServices);
864
864
 
865
865
  runInfinitePoll(timeInMinute, async () => {
866
- console.log(magenta(`Quick outdated check at ${new Date().toISOString()}`));
867
- if (await quickIsOutdated()) {
868
- console.log(magenta("Likely outdated, resyncing now"));
869
- await resyncServices();
870
- } else {
871
- let config = await machineInfos.get(getOwnMachineId());
872
- if (config) {
873
- config.heartbeat = Date.now();
874
- console.log(magenta(`Updating heartbeat for ${getOwnMachineId()} to ${config.heartbeat}`));
875
- await machineInfos.set(getOwnMachineId(), config);
876
- }
877
- }
866
+ //console.log(magenta(`Quick outdated check at ${new Date().toISOString()}`));
867
+ // console.log(magenta("Likely outdated, resyncing now"));
868
+ // NOTE: I'm not sure why we were hesitant to call this. It shouldn't be that slow...
869
+ await resyncServices();
870
+ // } else {
871
+ // let config = await machineInfos.get(getOwnMachineId());
872
+ // if (config) {
873
+ // config.heartbeat = Date.now();
874
+ // console.log(magenta(`Updating heartbeat for ${getOwnMachineId()} to ${config.heartbeat}`));
875
+ // await machineInfos.set(getOwnMachineId(), config);
876
+ // }
877
+ // }
878
878
  });
879
879
 
880
880
  runInfinitePoll(timeInMinute, async () => {
@@ -201,6 +201,10 @@ Please provide a SHORT search string that would match this type of error. The st
201
201
  - Be generic enough to match similar errors (avoid dynamic values like timestamps, IDs, or specific numbers)
202
202
  - Be a simple substring (no special operators)
203
203
 
204
+ DO NOT include variables. If something is some dynamic path that includes numbers, etc., definitely do not include that in the match pattern. That is a very, very bad match pattern.
205
+
206
+ The string must be exactly included. You can't stitch together pieces, it will be checked for with .includes() in javascript.
207
+
204
208
  Respond with a JSON object with a "pattern" field containing the search string.`;
205
209
 
206
210
  const response = await callOpenRouterJSON<PatternResponse>(openRouterAPIKey, prompt);
@@ -303,54 +307,58 @@ export async function exposeErrorWatchService() {
303
307
 
304
308
  let errorLogs = await getErrorLogs();
305
309
  for await (let error of watchAllValues(errorLogs)) {
306
- let suppressionEntries = await getSuppressionEntries();
307
- let suppressed = false;
308
- let matchedSuppressionId: string | undefined = undefined;
309
-
310
- for (let suppressionEntry of suppressionEntries) {
311
- let status = applySuppression(error, suppressionEntry);
312
- if (status === "suppressed" || status === "matched-timeout-passed") {
313
- matchedSuppressionId = suppressionEntry.id;
314
- void ErrorNotificationService.triggerSuppressionUpdate(suppressionEntry.id);
315
- }
316
- if (status === "suppressed") {
317
- suppressed = true;
310
+ try {
311
+ let suppressionEntries = await getSuppressionEntries();
312
+ let suppressed = false;
313
+ let matchedSuppressionId: string | undefined = undefined;
314
+
315
+ for (let suppressionEntry of suppressionEntries) {
316
+ let status = applySuppression(error, suppressionEntry);
317
+ if (status === "suppressed" || status === "matched-timeout-passed") {
318
+ matchedSuppressionId = suppressionEntry.id;
319
+ void ErrorNotificationService.triggerSuppressionUpdate(suppressionEntry.id);
320
+ }
321
+ if (status === "suppressed") {
322
+ suppressed = true;
323
+ }
318
324
  }
319
- }
320
325
 
321
- console.log(`Watch loop received error, ${suppressed ? "suppressed" : "not suppressed"}, matched suppression id: ${matchedSuppressionId}: ${error.param0}`);
326
+ console.log(`Watch loop received error, ${suppressed ? "suppressed" : "not suppressed"}, matched suppression id: ${matchedSuppressionId}: ${error.param0}`);
322
327
 
323
- if (suppressed && matchedSuppressionId) {
324
- queueDiscordNotification(matchedSuppressionId, 1, false);
325
- } else if (!suppressed) {
326
- if (unmatchedErrors.length > unmatchedIndex) {
327
- unmatchedErrors[unmatchedIndex] = error;
328
- unmatchedIndex = (unmatchedIndex + 1) % MAX_UNMATCHED;
329
- } else {
330
- unmatchedErrors.push(error);
331
- }
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
+ }
332
337
 
333
- if (!matchedSuppressionId) {
334
- const pattern = await generatePatternForError(error);
335
- if (pattern) {
336
- const newEntry: SuppressionEntry = {
337
- id: nextId(),
338
- pattern,
339
- timeout: 0,
340
- createdTime: Date.now(),
341
- lastUpdatedTime: Date.now(),
342
- };
343
-
344
- suppressionCache.push(newEntry);
345
- void suppression.set(newEntry.id, newEntry);
346
- applySuppression(error, newEntry);
347
- queueDiscordNotification(newEntry.id, 1, true);
348
-
349
- void ErrorNotificationService.triggerSuppressionUpdate(newEntry.id);
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
+ }
350
356
  }
351
- }
352
357
 
353
- void ErrorNotificationService.triggerUnmatchedError(error);
358
+ void ErrorNotificationService.triggerUnmatchedError(error);
359
+ }
360
+ } catch (error) {
361
+ console.warn("Error in watch loop:", error);
354
362
  }
355
363
  }
356
364
  }