aboutsummaryrefslogtreecommitdiff
path: root/src/route.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/route.rs')
-rw-r--r--src/route.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/route.rs b/src/route.rs
index 7dfa5e7..7140e52 100644
--- a/src/route.rs
+++ b/src/route.rs
@@ -22,6 +22,8 @@ use tokio::time::Instant;
use crate::ROUTES;
+pub const CACHE_RATE: u64 = 60 * 5;
+
#[derive(Debug)]
pub struct Route {
pub description: String,
@@ -62,7 +64,7 @@ pub fn cache(context: &windmark::returnable::RouteContext<'_>, response: &str) {
SyncLazy::new(|| Mutex::new(Instant::now()));
if (*LAST_CACHED.lock().unwrap()).elapsed()
- >= std::time::Duration::from_secs(crate::CACHE_RATE)
+ >= std::time::Duration::from_secs(CACHE_RATE)
|| (*ROUTES.lock().unwrap())
.get(context.url.path())
.is_some_and(|&r| r.text_cache.is_empty())