aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/resource/DeviceResource.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/api/resource/DeviceResource.java b/src/main/java/org/traccar/api/resource/DeviceResource.java
index 74e133f44..ff682d1d1 100644
--- a/src/main/java/org/traccar/api/resource/DeviceResource.java
+++ b/src/main/java/org/traccar/api/resource/DeviceResource.java
@@ -21,6 +21,7 @@ import org.traccar.model.Device;
import org.traccar.model.DeviceAccumulators;
import org.traccar.model.Position;
import org.traccar.model.User;
+import org.traccar.session.ConnectionManager;
import org.traccar.session.cache.CacheManager;
import org.traccar.storage.StorageException;
import org.traccar.storage.query.Columns;
@@ -48,6 +49,9 @@ public class DeviceResource extends BaseObjectResource<Device> {
@Inject
private CacheManager cacheManager;
+ @Inject
+ private ConnectionManager connectionManager;
+
public DeviceResource() {
super(Device.class);
}
@@ -125,7 +129,13 @@ public class DeviceResource extends BaseObjectResource<Device> {
new Columns.Include("positionId"),
new Condition.Equals("id", "id")));
- cacheManager.updatePosition(position);
+ try {
+ cacheManager.addDevice(position.getDeviceId());
+ cacheManager.updatePosition(position);
+ connectionManager.updatePosition(position);
+ } finally {
+ cacheManager.removeDevice(position.getDeviceId());
+ }
} else {
throw new IllegalArgumentException();
}