Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add delay when entering or leaving geofence to prevent flap #14

Merged
merged 1 commit into from
Dec 30, 2023

Conversation

brchri
Copy link
Owner

@brchri brchri commented Dec 30, 2023

It's possible while leaving or entering a geofence to incorrectly trigger an event, for example, when leaving an open geofence, it may appear to the app that the tracker left the geofence and then immediately returned inside, triggering an open event. This is due to how lat and lng are processed independently.

To prevent this, a timer is being added to each tracker for each geofence type defined. This will prevent triggering an open event if a tracker has just left and then immediately re-entered an open geofence, and vice-versa for a close geofence.

As a note, it's not currently possible to wait to process lat and lng as a pair, as both lat and lng are not always published together, for example if a tracker is traveling directly east or west, only the lng gets updated, lat does not, as the lat is not changing. As such, there's no way to determine if a lat or lng update will have a corresponding pair, so they must be processed independently, even though it results in slightly incorrect positioning when the pair hasn't yet been processed. For the most part, this is harmless, but it did cause this issue as it appeared that the tracker was teleporting out of a geofence and then back in. Putting a flap timer in should resolve this while still allowing the processing of lat and lng independently.

@brchri brchri merged commit 505b38b into main Dec 30, 2023
6 checks passed
@brchri brchri deleted the add-delay-fix-flap branch December 30, 2023 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant