Synchronize access to account to avoid concurrency issues (#14128)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
Kai Kreuzer 2023-01-01 12:02:15 +01:00 committed by GitHub
parent 377dc86452
commit f588c07f3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -818,6 +818,7 @@ public class TeslaVehicleHandler extends BaseThingHandler {
if (authHeader != null) {
try {
// get a list of vehicles
synchronized (account.vehiclesTarget) {
Response response = account.vehiclesTarget.request(MediaType.APPLICATION_JSON_TYPE)
.header("Authorization", authHeader).get();
@ -844,6 +845,8 @@ public class TeslaVehicleHandler extends BaseThingHandler {
return vehicle;
}
}
}
} catch (ProcessingException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}