mirror of
https://git.ethanthesleepy.one/ethanaobrien/ew.git
synced 2025-05-13 11:37:33 -05:00
Fix event scores json endpoint
This commit is contained in:
parent
2a4d927a41
commit
d420bec782
1 changed files with 7 additions and 5 deletions
|
@ -98,11 +98,13 @@ fn get_json() -> JsonValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_scores_json() -> JsonValue {
|
pub async fn get_scores_json() -> JsonValue {
|
||||||
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
|
let cache = {
|
||||||
if result.is_none() {
|
let mut result = crate::lock_onto_mutex!(CACHED_DATA);
|
||||||
result.replace(get_json());
|
if result.is_none() {
|
||||||
}
|
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…
Add table
Reference in a new issue