Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow MQTT topic to have wildcards (# or +) #5398

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

EricDuminil
Copy link

@EricDuminil EricDuminil commented Nov 29, 2024

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Fixes #1669 : MQTT topic couldn't contain any wildcard, due to a too restrictive check.
If a message was received, it means the topic was correct, which means no further check is required.

The change is small enough that I took the liberty to not start a discussion first.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

Looks reasonable.
I have added one question below where I am a bit confused.

I have not looked into if this is a v2.0 (Bugfix of something in the beta) or v2.1 (new feature) PR

@@ -52,7 +54,7 @@ async function testMqtt(mqttSuccessMessage, mqttCheckType, receivedMessage) {
}

describe("MqttMonitorType", {
concurrency: true,
concurrency: 4,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the background behind this change? How was 4 chosen? 🤔

Copy link
Author

Choose a reason for hiding this comment

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

I almost doubled the number of tests in this describe. For each test, a HiveMQ docker container is started. With concurrency: true, they are all started at the same time.

My powerful laptop and servers didn't like too much starting 13 containers at exactly the same time. The test suite needed over 2 minutes, and sometimes didn't even return at all. With concurrency: 4, the suite consistently required ~22s, which cannot get much better with a 20s timeout. There are 3 timeout tests, so concurrency: 3 would probably be fine as well. Anything more than 4 and I'd be afraid to DDOS other computers when testing.

@EricDuminil
Copy link
Author

I have not looked into if this is a v2.0 (Bugfix of something in the beta) or v2.1 (new feature) PR

As you wish. Since the core of this bugfix is basically just removing one if (messageTopic === topic), it might be interesting to fix it in the 1.23 branch too.

@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Dec 2, 2024
Copy link
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.
I am treating this as a feature
=> putting it into the v2.1 release window.

@CommanderStorm CommanderStorm added the pr:depends on other pending other things to be done first label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:depends on other pending other things to be done first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MQTT Monitor Type - Timeout
2 participants