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

Location Validation Timestamp Cache #938

Merged
merged 12 commits into from
Feb 11, 2025

Conversation

michaeldjeffrey
Copy link
Contributor

@michaeldjeffrey michaeldjeffrey commented Feb 5, 2025

Heartbeats from radios come with a location_validation_timestamp, which is the last time a radio had it's location validated.

A location_validation_timestamp is valid for up to 24 hours from the first time it was received in a heartbeat.

Previously, we assumed that a heartbeat with a location_validation_timestamp had already passed this check. That has been found to not be the case. So "validated heartbeats" were being output with location_validation_timestamp's far in the past.

Now, we are correctly verifying that a location_validation_timestamp is within 24 hours of the first received heartbeat that declared it.

@bbalser
Copy link
Contributor

bbalser commented Feb 6, 2025

Test is failing due to different level of precision coming out of db than expected.

@kurotych kurotych self-requested a review February 6, 2025 15:04
location_validation_timestamps are only valid within a 24 hour window of the time the heartbeat was received.
- rename cache methods to be more like cache methods.
- validation timestamps that are in the past will not be cached.
- validation timestamps older than 24 hours from the heartbeat will not be returned from the database.
- cached locations that are older than 24 hours from the current hearbeat requesting a value will not be returned even if they still have a valid TTL.
- location validation timestamps must be within the last 24 hours.

- LocationCache will only respect the 12 hour time limit when it's fresh.
reflect this in the name
The initial heartbeat has a validation timestamp that is just barely valid, so when the second heartbeat comes through over 24 hours past the validation timestamp, it will correctly not consider it.
… for comparing

truncate to nanoseconds, some postgres DB version only store seconds up
to 5 decimal places.
@michaeldjeffrey michaeldjeffrey force-pushed the mj/location-validation-timestamp-cache branch from 4c68a97 to 3f79329 Compare February 7, 2025 18:01
@michaeldjeffrey michaeldjeffrey marked this pull request as ready for review February 7, 2025 18:36
@michaeldjeffrey michaeldjeffrey force-pushed the mj/location-validation-timestamp-cache branch from cbd6ab3 to b828bd3 Compare February 7, 2025 20:19
@bbalser bbalser merged commit bcac912 into main Feb 11, 2025
17 checks passed
@bbalser bbalser deleted the mj/location-validation-timestamp-cache branch February 11, 2025 12:32
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.

4 participants