i hate programming :(((((((((( >_<

This commit is contained in:
Ethan O'Brien
2024-11-20 22:13:11 -06:00
parent 4d9991ce75
commit 7493724cd7
4 changed files with 88 additions and 94 deletions

View File

@ -167,11 +167,13 @@ fn get_json() -> JsonValue {
}
async fn get_clearrate_json() -> JsonValue {
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
if result.is_none() {
result.replace(get_json());
}
let cache = result.as_ref().unwrap();
let cache = {
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
if result.is_none() {
result.replace(get_json());
}
result.as_ref().unwrap().clone()
};
let rv = cache["cache"].clone();
if cache["last_updated"].as_u64().unwrap() + (60 * 60) < global::timestamp() {
let mut result = crate::lock_onto_mutex!(CACHED_DATA);