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

Have mobile-config track when the data for a mobile-radio changes #902

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

bbalser
Copy link
Contributor

@bbalser bbalser commented Nov 25, 2024

Add ability for mobile-config to track when the data for a mobile radio changes.

  • Add tests

@bbalser bbalser marked this pull request as ready for review November 26, 2024 15:17
Copy link
Contributor

@jeffgrunewald jeffgrunewald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one concern i have is that we're converting all these hotspot info fields to integers when we pull them in, presumably for easier hashing, but not clear to me if the resulting in Mobile Info is stored somewhere or if its exclusively used for determining a hash to see when the hotspot changes. is there a followup change to actually wire this "hotspot tracked changes" into the query api to do a mobile info api query filtering based on hotspots updated since X? and if yes would those be pulling the metadata (or cached) versions of the data being hashed by integer representation then?

mobile_config/src/settings.rs Outdated Show resolved Hide resolved
mobile_config/src/settings.rs Outdated Show resolved Hide resolved
refreshed_at: DateTime<Utc>,
location: Option<i64>,
is_full_hotspot: Option<i32>,
num_location_asserts: Option<i32>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we care about this field?

Comment on lines +19 to +20
device_type: String,
deployment_info: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be able to, at the very least cast these to serde_json::Values if not use serde_json to convert them all the way to a full struct type that mirrors the jsonb of the db field. would at least be more parseable than just taking the json as a string

entity_key: EntityKey,
refreshed_at: DateTime<Utc>,
location: Option<i64>,
is_full_hotspot: Option<i32>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really just a bool, right?

@jeffgrunewald
Copy link
Contributor

does it make any more sense to extend the existing struct that we convert metadata hotspot info into to include the additional fields added in the new MobileRadio type added in the tracker module and then conditionally cast fields into their easily hashable formats (i32/i64) in the impl for converting the info struct to a change-tracked radio and reduce some duplication and drift in the different postgres-conversion structs?

@kurotych kurotych self-requested a review December 4, 2024 08:50
Comment on lines +229 to +234
.filter_map(|result| async move {
if let Err(err) = &result {
tracing::error!(?err, "error when reading radio metadata");
}
result.ok()
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to hide such errors but rather return an error result and stop updating to avoid the possibility of finishing with an inconsistent result.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indeed a code smell.. why is this masking the error?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do this in several places where we perform get_all operations by services/agents; typically the logic has been to allow the overall system to continue operating in a degraded state, reporting errors as they happen, rather than causing a single bad record in 10s of thousands to cause the entire operation like a cache refresh in the mobile-verifier or rewardable entity distribution to grind to a halt, usually in off hours

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair.. the downside is that without looking at the logs (which no client does) you'd end up operating on partial data?

@kurotych kurotych merged commit 44b26c5 into main Dec 4, 2024
17 checks passed
@kurotych kurotych deleted the bbalser/mobile-radio-tracker branch December 4, 2024 09:07
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