Fix event scores json endpoint

This commit is contained in:
Ethan O'Brien 2024-11-23 08:26:39 -06:00
parent 2a4d927a41
commit d420bec782

View file

@ -98,11 +98,13 @@ fn get_json() -> JsonValue {
}
pub async fn get_scores_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);