Skip to content

Commit

Permalink
fix: only initialize sentry if it's not already happened
Browse files Browse the repository at this point in the history
This should reduce memory usage and hopefully fix a memory leak
  • Loading branch information
Steven Weingärtner committed Sep 20, 2024
1 parent e16ed58 commit ce9637e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/node-logger-plugin-sentry/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ export default class PluginSentry {
...rest,
};

Sentry.init({
debug: this.config.sentry.debug,
dsn: this.config.sentry.dsn,
environment: this.config.sentry.environment,
release: this.config.sentry.release,
maxBreadcrumbs: this.config.sentry.maxBreadcrumbs,
integrations(integrations) {
return integrations
.filter(integration => integration.name !== 'Console');
},
});
if (!Sentry.isInitialized()) {
Sentry.init({
debug: this.config.sentry.debug,
dsn: this.config.sentry.dsn,
environment: this.config.sentry.environment,
release: this.config.sentry.release,
maxBreadcrumbs: this.config.sentry.maxBreadcrumbs,
integrations(integrations) {
return integrations
.filter(integration => integration.name !== 'Console');
},
});
}
}

log(event) {
Expand Down

0 comments on commit ce9637e

Please sign in to comment.