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

View File

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