diff options
author | Anton Tananaev <anton@traccar.org> | 2022-07-14 17:00:57 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-07-14 17:00:57 -0700 |
commit | 0bd4c493e9003449457e87ebad6c7016ded71c8d (patch) | |
tree | 4beefd16bdc7665154d73fc07967ac45b1a06a49 /src/main/java/org/traccar/handler/GeocoderHandler.java | |
parent | 34fefbffa49925a5d337ff388fb9db400d707f8b (diff) | |
download | trackermap-server-0bd4c493e9003449457e87ebad6c7016ded71c8d.tar.gz trackermap-server-0bd4c493e9003449457e87ebad6c7016ded71c8d.tar.bz2 trackermap-server-0bd4c493e9003449457e87ebad6c7016ded71c8d.zip |
Add LBS location caching (fix #3790)
Diffstat (limited to 'src/main/java/org/traccar/handler/GeocoderHandler.java')
-rw-r--r-- | src/main/java/org/traccar/handler/GeocoderHandler.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/handler/GeocoderHandler.java b/src/main/java/org/traccar/handler/GeocoderHandler.java index 0248fca05..e4f240a90 100644 --- a/src/main/java/org/traccar/handler/GeocoderHandler.java +++ b/src/main/java/org/traccar/handler/GeocoderHandler.java @@ -35,14 +35,14 @@ public class GeocoderHandler extends ChannelInboundHandlerAdapter { private final CacheManager cacheManager; private final boolean ignorePositions; private final boolean processInvalidPositions; - private final int geocoderReuseDistance; + private final int reuseDistance; public GeocoderHandler(Config config, Geocoder geocoder, CacheManager cacheManager) { this.geocoder = geocoder; this.cacheManager = cacheManager; ignorePositions = config.getBoolean(Keys.GEOCODER_IGNORE_POSITIONS); processInvalidPositions = config.getBoolean(Keys.GEOCODER_PROCESS_INVALID_POSITIONS); - geocoderReuseDistance = config.getInteger(Keys.GEOCODER_REUSE_DISTANCE, 0); + reuseDistance = config.getInteger(Keys.GEOCODER_REUSE_DISTANCE, 0); } @Override @@ -50,10 +50,10 @@ public class GeocoderHandler extends ChannelInboundHandlerAdapter { if (message instanceof Position && !ignorePositions) { final Position position = (Position) message; if (processInvalidPositions || position.getValid()) { - if (geocoderReuseDistance != 0) { + if (reuseDistance != 0) { Position lastPosition = cacheManager.getPosition(position.getDeviceId()); if (lastPosition != null && lastPosition.getAddress() != null - && position.getDouble(Position.KEY_DISTANCE) <= geocoderReuseDistance) { + && position.getDouble(Position.KEY_DISTANCE) <= reuseDistance) { position.setAddress(lastPosition.getAddress()); ctx.fireChannelRead(position); return; |