[discuss] Missing MetricOffset: use cache VS create service
This case appears in the GPS tracking feature VehiclePosition
and FollowRoadProjectionMovingMethod
.
These classes are dependant of the metric offset validity (taken from database) so we can not call directly Edge::getMetricOffset()
because sometimes some values are missing ant it returns 0
. Instead we use a cache which automatically detects missings and recalculate them (does not save in the database for avoid side effects): PathGeometryCache
(see #813).
The metric offset can be "automatically" calculated and saved in the database from the admin when user clicks on this icon (example 0
-> 243
):
The problem is that is is a heavy job for a human, there is thousands of edges and missing data, manually click on each edge's icons will take several days of work.
For now everything works because the cache calculates missing values but maybe it could be a good idea to fix them in the database instead of worry about missing values at execution ?
Solutions:
- Cache should save its calculation in the DB so next time no worries
- Important: cache usage is not generalized so some values will only be fixed when the GPS tracking is used
-
Extract the auto calculation from cache and create a dedicated service API which consolidate the DB (example:
/?a=consolidate_metric_offset&path=all
) and in GPS tracking feature refuse a path with missing offsets (see 0c3bd0d5, the code detects this but was removed when cache was introduced) - Notion of metric offset could be removed from the cache
Important: in both cases it would be great to generalize usage of cache