Fix event scores json endpoint
This commit is contained in:
parent
2a4d927a41
commit
d420bec782
@ -98,11 +98,13 @@ fn get_json() -> JsonValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_scores_json() -> JsonValue {
|
pub async fn get_scores_json() -> JsonValue {
|
||||||
|
let cache = {
|
||||||
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
|
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
|
||||||
if result.is_none() {
|
if result.is_none() {
|
||||||
result.replace(get_json());
|
result.replace(get_json());
|
||||||
}
|
}
|
||||||
let cache = result.as_ref().unwrap();
|
result.as_ref().unwrap().clone()
|
||||||
|
};
|
||||||
let rv = cache["cache"].clone();
|
let rv = cache["cache"].clone();
|
||||||
if cache["last_updated"].as_u64().unwrap() + (60 * 60) < global::timestamp() {
|
if cache["last_updated"].as_u64().unwrap() + (60 * 60) < global::timestamp() {
|
||||||
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
|
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user