Skip to content

Conversation

@Half-Shot
Copy link
Contributor

The bridge is prone to erroring with things like:

(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
    at PrometheusBridgeMetrics.sdkEndMetric (/src/metrics.ts:207:54)
    at /node_modules/matrix-bot-sdk/lib/metrics/Metrics.js:73:39
    at Array.forEach (<anonymous>)
    at Metrics.end (/node_modules/matrix-bot-sdk/lib/metrics/Metrics.js:73:24)
    at /node_modules/matrix-bot-sdk/lib/metrics/decorators.js:35:40
    at <anonymous>
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Which is mostly due to the fact that our metrics system is:

  1. Not correctly initalising the Maps
  2. Listening in the wrong places for the wrong metrics.

I've also updated the matrix-appservice-bridge library to be on the latest version, I don't think it's changes will affect us too badly.

@Half-Shot
Copy link
Contributor Author

Depends on #811 due to requiring Node 14.

@Half-Shot Half-Shot requested a review from a team July 15, 2022 08:21
@@ -1,5 +1,5 @@
/*
Copyright 2017 - 2019 matrix-appservice-discord
Copyright 2017 - 2019 matrix-appservice-discord, 2022 (C) The Matrix.org Foundation C.I.C.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's just make a single change to update all of these at once 😆

const eventProcessor = discordbot.MxEventProcessor;


process.once("SIGINT", () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should trigger on SIGTERM too.

public stop(): void {
this.presenceHandler.Stop();
this._bot?.destroy();
this._bot = undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick suggestion:

if (this._bot) {
    this._bot.destroy();
    this._bot = undefined; 
}

since there's a branch buried in the ?. anyways.

@Half-Shot Half-Shot self-assigned this Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants