Skip to content
Snippets Groups Projects
Unverified Commit b17b3bef authored by Kevin Aleman's avatar Kevin Aleman Committed by GitHub
Browse files

fix: Avoid notifying `watch.settings` on uncaught errors (#33376)

parent 92e366ee
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,13 @@ import { Meteor } from 'meteor/meteor'; ...@@ -3,14 +3,13 @@ import { Meteor } from 'meteor/meteor';
import { throttledCounter } from '../../../../lib/utils/throttledCounter'; import { throttledCounter } from '../../../../lib/utils/throttledCounter';
import { sendMessage } from '../../../lib/server/functions/sendMessage'; import { sendMessage } from '../../../lib/server/functions/sendMessage';
import { notifyOnSettingChanged } from '../../../lib/server/lib/notifyListener';
import { settings } from '../../../settings/server'; import { settings } from '../../../settings/server';
const incException = throttledCounter((counter) => { const incException = throttledCounter((counter) => {
Settings.incrementValueById('Uncaught_Exceptions_Count', counter, { returnDocument: 'after' }) Settings.incrementValueById('Uncaught_Exceptions_Count', counter, { returnDocument: 'after' })
.then(({ value }) => { .then(({ value }) => {
if (value) { if (value) {
void notifyOnSettingChanged(value); settings.set(value);
} }
}) })
.catch(console.error); .catch(console.error);
...@@ -118,5 +117,12 @@ process.on('unhandledRejection', (error) => { ...@@ -118,5 +117,12 @@ process.on('unhandledRejection', (error) => {
process.on('uncaughtException', async (error) => { process.on('uncaughtException', async (error) => {
incException(); incException();
console.error('=== UnCaughtException ===');
console.error(error);
console.error('-------------------------');
console.error('Errors like this can cause oplog processing errors.');
console.error('===========================');
void errorHandler.trackError(error.message, error.stack); void errorHandler.trackError(error.message, error.stack);
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment