Correction: So apparently instance 1 uses the cached position which had not been updated
I am seeing that ConnectionManager.updatePosition() is called in instance 1 from BaseBroadcastService.handleMessage().
I don't see a call to CacheManager.updatePosition() though
I am seeing a call to updatePosition(local=false, ...)
but an implementation of CacheManager.updatePosition() without the local param
So that method will never be called from BaseBroadcastService.handleMessage(). Is that intended?
I am seeing three registered listeners to the broadcast service and it seems that the CacheManager is one of them
It could be a race condition if you receive a new location and update at the same time.
There is a potential for a race condition here, but this is not it. The position in the cache manager is never updated in such a case - due to the design of the code. And I assume that this is not the intention.
Yeah, I think that's because we assume that the position data is coming only from a device.
Hi
We have one dedicated server instance for receiving device data and one instance for serving the frontend. We are using the redis based broadcastservice. When an accumulator value (totalDistance) is set via instance 2 via DeviceResource.updateAccumulators() that value is written into the DB but overwritten by instance 1 with the next incoming datapoints.
I am looking at the code
https://github.com/traccar/traccar/blob/master/src/main/java/org/traccar/api/resource/DeviceResource.java#L153
I am seeing that this has been sent
I am seeing an incoming message in BaseBroadcastService.handleMessage()
But in the DB I am seeing one single position with the new value and the next position with the old one. So apparently instance 2 uses the cached position which had not been updated
Any ideas?