[feat]: create a warning if an instance has too many objects #3070
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link the feature issue which is closed by this PR
This is a proposal out of the blue after I yesterday noticed that I have 146k objects on my system, which lead to it being very slow. Often this happens due to BLE scanners, e.g. in my case one of my ESPresense devices was not configured to limit MQTT messages to specific MAC addresses and was sending every device it has seen once to the MQTT adapter.
Many users could wonder why their installation is that slow and would assume some adapter broke their installation or whatever and getting frustrated of ioB. Hence we should warn that there are issues in advance.
Implementation details
Introduced a state per adapter instance
system.adapter.<adapter>.<instance>.objectsWarnLimit
, this defaults to5000
.If this limit is exceeded we generate a warning log + alert notification with some details. So user already knows which adapter instance is the problem.
If it is intended to have that many states, the user can manually increase the state.
The check happens one time at instance start.
Tests
Documentation
If no tests added, please specify why it was not possible
We have no capabilities to test messages on controller level, as the main.js ist not actually running, only DB classes are running.