Are position handlers thread-safe?

memesaregood14 days ago

I keep getting into an issue when the device sends too many messages at once (e.g. from the black box) and Traccar doesn't seem to keep up. According to my logs, it processes one position from a device, and right after that another one, but it seems the handler uses the same last position in the handler at both times. Is multithreading somehow used in ProcessingHandler and how can I keep this issue from happening? Can I set up a 100ms delay between processing the next position from the same device?

Anton Tananaev14 days ago

There should be no parallel processing for the same device. Why would you want a delay between processing?

As for using same last value, that would only happen if it's the last position by time.

memesaregood14 days ago

By which time exactly? Server time?

Anton Tananaev14 days ago

Traccar always uses the fix time.

memesaregood14 days ago

How would Traccar choose the position if there are several positions with the same fix time?

Anton Tananaev14 days ago

If the fix time is the same, they will be processed in the order they come.

memesaregood14 days ago

Okay, but how will the last position be determined if there are several positions with the same fix time in the storage?