stefan-kaestle / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
16 stars 1 forks source link

When controller is restarting, isAccessPossible returns true although the service is still unavailable #75

Closed coeing closed 3 years ago

coeing commented 3 years ago

I had this case while testing the fix for #74

The logs show it pretty good:

2021-01-28 19:34:17.356 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Initializing Bosch SHC Bridge: org.openhab.binding.boschshc.internal.devices.bridge.BoschSHCBridgeHandler@1167c5ff - HTTP client is: BoschHttpClient@5f2ed6d2{STARTED} - version: 2020-04-05 2021-01-28 19:34:17.367 [DEBUG] [ernal.devices.bridge.BoschHttpClient] - Access check response complete: - return code: 503 2021-01-28 19:34:17.368 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Sending http request to Bosch to request rooms 2021-01-28 19:34:17.377 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Response complete: - return code: 503 2021-01-28 19:34:17.378 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Sending http request to Bosch to request clients: BoschHttpClient@5f2ed6d2{STARTED} 2021-01-28 19:34:17.388 [DEBUG] [devices.bridge.BoschSHCBridgeHandler] - Response complete: - return code: 503

What we should do in my opinion is to check the return code of the response as well.

GerdZanker commented 3 years ago

Yes, indeed. When the server responsed with HTTP-Statuscode 503 Service Unavailable we should not return true in isAccessPossible(). In this case of a failed response and in case of a HTTP error code isAccessPossible() has to return false.

coeing commented 3 years ago

Yes, indeed. When the server responsed with HTTP-Statuscode 503 Service Unavailable we should return true in isAccessPossible ()

should or should not? :)

GerdZanker commented 3 years ago

" should not " - I updated me comment

coeing commented 3 years ago

@GerdZanker I think this should go into 1.1 or should I prepare the pull request for openHAB already?

GerdZanker commented 3 years ago

Yes, I also want a fix in 1.1 and provide code + PR during this week (at least that's my plan).

Do you @coeing already want to build a "1.1 Beta 1" version for testing?

coeing commented 3 years ago

@GerdZanker Sounds good, hope nothing gets in your way ;) The test version for #74 had almost everything in it that the pull request had, so I'd like to wait for the version to be complete before asking our users to test it.