We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 09005c7 commit aac6330Copy full SHA for aac6330
mobile_verifier/src/heartbeats/location_cache.rs
@@ -73,8 +73,13 @@ impl LocationCache {
73
{
74
let data = self.data.lock().await;
75
if let Some(&value) = data.get(&key) {
76
- // TODO: When we get it timestamp more than 12h old should we remove an try to fetch new one?
77
- return Ok(Some(value));
+ let now = Utc::now();
+ let twelve_hours_ago = now - Duration::hours(12);
78
+ if value.timestamp > twelve_hours_ago {
79
+ return Ok(None);
80
+ } else {
81
+ return Ok(Some(value));
82
+ }
83
}
84
85
match key {
0 commit comments