-
Notifications
You must be signed in to change notification settings - Fork 27
Implement tracked radios cache #928
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
base: main
Are you sure you want to change the base?
Conversation
…the middle of streaming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless there's some edge cases around working with the RwLock i believe the calls to clone the arc can be simplified to simply .clone()
the the cache struct field value since the arc implements the lightweight reference-counted clone
|
||
pub type TrackedRadiosMap = HashMap<PublicKeyBinary, DateTime<Utc>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this would make sense as it's own type
#[derive(Clone)]
pub struct TrackedRadiosMap(Arc<RwLock<HashMap<PublicKeyBinary, DateTime<Utc>>>);
We would get Clone for free.
And we could hang methods like get_updated_radios
off of it, and it would self update.
And other access methods could manage the read locking instead of the user.
Just thinking out loud.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it want you mean?
48dcfd4
The cache updates each time mobile tracker runs