Synchronize access to account to avoid concurrency issues (#14128)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
parent
377dc86452
commit
f588c07f3a
@ -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());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user