Traccar Gaps #4

Closed
opened 2026-02-07 15:37:56 -08:00 by kyle · 1 comment
Owner

image.png I am not certain what the issue is with this in Traccar or what, but the drivers phone had pretty good fidelity for some parts of the trip, but for other parts of the trip it did not and it made it look like the user took straight trips like they were teleporting from site to site. I'd like to get more frequent pings to show more fidelity on movement. This has implications for mileage.

<img width="485" alt="image.png" src="attachments/25db5be0-c1b4-4d1a-929e-58aea058edf7"> I am not certain what the issue is with this in Traccar or what, but the drivers phone had pretty good fidelity for some parts of the trip, but for other parts of the trip it did not and it made it look like the user took straight trips like they were teleporting from site to site. I'd like to get more frequent pings to show more fidelity on movement. This has implications for mileage.
340 KiB
Author
Owner

Implemented in this deploy:

Root Cause: syncPositions() was calling getAllPositions() which only returns the LATEST position per device, discarding all intermediate positions Traccar stored.

Fix - Backend:

  • Changed cron from EVERY_MINUTE to EVERY_30_SECONDS
  • Rewrote syncPositions() to call getPositionHistory(deviceId, since, now) per device
  • Uses device.lastActive with 5s overlap buffer as the 'since' parameter
  • Batch inserts via createMany({ skipDuplicates: true })
  • Added @@unique([deviceId, timestamp]) constraint to prevent duplicates
  • Per-device error handling so one failure doesn't block others

Fix - Frontend:

  • Lowered update interval minimum from 30s to 10s
  • Added info tip: 15-30s for active events, 60s for routine use
  • Note that changing interval only affects new QR enrollments
  • Reduced map polling from 30s to 15s for smoother updates
Implemented in this deploy: **Root Cause:** syncPositions() was calling getAllPositions() which only returns the LATEST position per device, discarding all intermediate positions Traccar stored. **Fix - Backend:** - Changed cron from EVERY_MINUTE to EVERY_30_SECONDS - Rewrote syncPositions() to call getPositionHistory(deviceId, since, now) per device - Uses device.lastActive with 5s overlap buffer as the 'since' parameter - Batch inserts via createMany({ skipDuplicates: true }) - Added @@unique([deviceId, timestamp]) constraint to prevent duplicates - Per-device error handling so one failure doesn't block others **Fix - Frontend:** - Lowered update interval minimum from 30s to 10s - Added info tip: 15-30s for active events, 60s for routine use - Note that changing interval only affects new QR enrollments - Reduced map polling from 30s to 15s for smoother updates
kyle closed this issue 2026-02-07 22:36:24 -08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kyle/vip-coordinator#4