]> git.basschouten.com Git - openhab-addons.git/commit
[boschshc] Cache mDNS-based bridge discovery results (#16211)
authorDavid Pace <dev@davidpace.de>
Mon, 15 Jan 2024 20:09:45 +0000 (21:09 +0100)
committerGitHub <noreply@github.com>
Mon, 15 Jan 2024 20:09:45 +0000 (21:09 +0100)
commit777def6ed233ab47050ed3d86b2847750c9fbbc1
tree1a1d88c077d81688a1ae974c1ea919ebec988432
parent7c2abc4115617b8994ce78c200b3ac4d45179e92
[boschshc] Cache mDNS-based bridge discovery results (#16211)

* [boschshc] Cache mDNS-based bridge discovery results

The bridge discovery participant receives lots of mDNS events.
Previously, all events that contained IP addresses of potential bridges
were actively contacted using HTTP requests. On some systems eventually
the long polling stops due to too many requests.

With this change, we
* only consider mDNS events where the name property starts with "Bosch
SHC"
* cache already discovered bridges so we don't have to contact them over
and over again
* make sure that this happens in a thread-safe manner because the mDNS
events are handled in individual concurrently running threads

Signed-off-by: David Pace <dev@davidpace.de>
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/devices/bridge/BoschHttpClient.java
bundles/org.openhab.binding.boschshc/src/main/java/org/openhab/binding/boschshc/internal/discovery/BridgeDiscoveryParticipant.java
bundles/org.openhab.binding.boschshc/src/main/resources/OH-INF/addon/addon.xml
bundles/org.openhab.binding.boschshc/src/test/java/org/openhab/binding/boschshc/internal/discovery/BridgeDiscoveryParticipantTest.java