diff options
| author | Fuwn <[email protected]> | 2026-02-12 02:25:38 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 02:25:38 -0800 |
| commit | 8f16690dbf2838c2e2904a5252e64e60d8af4c73 (patch) | |
| tree | b19fb4420f568b35d71e0ccd498c6bbc5c75c03e /src/modules | |
| parent | fix: Bundle root CA certs via rustls-tls for production containers (diff) | |
| download | locus-8f16690dbf2838c2e2904a5252e64e60d8af4c73.tar.xz locus-8f16690dbf2838c2e2904a5252e64e60d8af4c73.zip | |
feat(blog): Configurable Notion refresh interval via environment variable
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/blog/module.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/modules/blog/module.rs b/src/modules/blog/module.rs index bb88122..ca20afc 100644 --- a/src/modules/blog/module.rs +++ b/src/modules/blog/module.rs @@ -345,17 +345,15 @@ fn fetch_from_notion() { } pub fn refresh_loop() { - info!("spawned Notion blog refresh loop"); + let refresh_interval_seconds = std::env::var("NOTION_REFRESH_INTERVAL") + .ok() + .and_then(|value| value.parse::<u64>().ok()) + .unwrap_or(300); + + info!("spawned Notion blog refresh loop ({refresh_interval_seconds}s interval)"); loop { - std::thread::sleep(std::time::Duration::from_secs( - #[cfg(debug_assertions)] - 5, - #[cfg(not(debug_assertions))] - { - 60 * 5 - }, - )); + std::thread::sleep(std::time::Duration::from_secs(refresh_interval_seconds)); match std::panic::catch_unwind(fetch_from_notion) { Ok(()) => info!("refreshed blog data from Notion"), |