querysub 0.386.0 → 0.388.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.386.0",
3
+ "version": "0.388.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,8 @@ 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
+
204
206
  Respond with a JSON object with a "pattern" field containing the search string.`;
205
207
 
206
208
  const response = await callOpenRouterJSON<PatternResponse>(openRouterAPIKey, prompt);
@@ -303,54 +305,58 @@ export async function exposeErrorWatchService() {
303
305
 
304
306
  let errorLogs = await getErrorLogs();
305
307
  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
- void ErrorNotificationService.triggerSuppressionUpdate(suppressionEntry.id);
314
- }
315
- if (status === "suppressed") {
316
- suppressed = true;
317
- matchedSuppressionId = suppressionEntry.id;
308
+ try {
309
+ let suppressionEntries = await getSuppressionEntries();
310
+ let suppressed = false;
311
+ let matchedSuppressionId: string | undefined = undefined;
312
+
313
+ for (let suppressionEntry of suppressionEntries) {
314
+ let status = applySuppression(error, suppressionEntry);
315
+ if (status === "suppressed" || status === "matched-timeout-passed") {
316
+ matchedSuppressionId = suppressionEntry.id;
317
+ void ErrorNotificationService.triggerSuppressionUpdate(suppressionEntry.id);
318
+ }
319
+ if (status === "suppressed") {
320
+ suppressed = true;
321
+ }
318
322
  }
319
- }
320
323
 
321
- console.log(`Watch loop received error, ${suppressed ? "suppressed" : "not suppressed"}, matched suppression id: ${matchedSuppressionId}: ${error.param0}`);
324
+ console.log(`Watch loop received error, ${suppressed ? "suppressed" : "not suppressed"}, matched suppression id: ${matchedSuppressionId}: ${error.param0}`);
322
325
 
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
- }
326
+ if (suppressed && matchedSuppressionId) {
327
+ queueDiscordNotification(matchedSuppressionId, 1, false);
328
+ } else if (!suppressed) {
329
+ if (unmatchedErrors.length > unmatchedIndex) {
330
+ unmatchedErrors[unmatchedIndex] = error;
331
+ unmatchedIndex = (unmatchedIndex + 1) % MAX_UNMATCHED;
332
+ } else {
333
+ unmatchedErrors.push(error);
334
+ }
332
335
 
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);
336
+ if (!matchedSuppressionId) {
337
+ const pattern = await generatePatternForError(error);
338
+ if (pattern) {
339
+ const newEntry: SuppressionEntry = {
340
+ id: nextId(),
341
+ pattern,
342
+ timeout: 0,
343
+ createdTime: Date.now(),
344
+ lastUpdatedTime: Date.now(),
345
+ };
346
+
347
+ suppressionCache.push(newEntry);
348
+ void suppression.set(newEntry.id, newEntry);
349
+ applySuppression(error, newEntry);
350
+ queueDiscordNotification(newEntry.id, 1, true);
351
+
352
+ void ErrorNotificationService.triggerSuppressionUpdate(newEntry.id);
353
+ }
350
354
  }
351
- }
352
355
 
353
- void ErrorNotificationService.triggerUnmatchedError(error);
356
+ void ErrorNotificationService.triggerUnmatchedError(error);
357
+ }
358
+ } catch (error) {
359
+ console.warn("Error in watch loop:", error);
354
360
  }
355
361
  }
356
362
  }