aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-22 08:58:34 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-22 08:58:34 -0700
commitd24edbc439a96b38442be1fbbfaccf65f0dd1923 (patch)
tree48c76d259bceb4b575eec76e07e875a7804225c3 /src/main/java/org/traccar/api
parent6a608f109ab587803092374591d1ec22e8f40fb7 (diff)
downloadtrackermap-server-d24edbc439a96b38442be1fbbfaccf65f0dd1923.tar.gz
trackermap-server-d24edbc439a96b38442be1fbbfaccf65f0dd1923.tar.bz2
trackermap-server-d24edbc439a96b38442be1fbbfaccf65f0dd1923.zip
Fix accumulator update
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();
}