From d24edbc439a96b38442be1fbbfaccf65f0dd1923 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 22 Jun 2022 08:58:34 -0700 Subject: Fix accumulator update --- src/main/java/org/traccar/api/resource/DeviceResource.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/org/traccar/api/resource/DeviceResource.java') 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 { @Inject private CacheManager cacheManager; + @Inject + private ConnectionManager connectionManager; + public DeviceResource() { super(Device.class); } @@ -125,7 +129,13 @@ public class DeviceResource extends BaseObjectResource { 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(); } -- cgit v1.2.3