From 71470840422a62f5bba5baeee960844231b41b78 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Sun, 23 Feb 2025 00:03:28 -0600 Subject: Fix locking logic to avoid spamming the channel when the Discord API is slow. --- src/labwatch.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/labwatch.rs b/src/labwatch.rs index e2f8a7c..5445a04 100644 --- a/src/labwatch.rs +++ b/src/labwatch.rs @@ -39,6 +39,9 @@ async fn tick(config: &HandlerConfig, ctx: &Context) -> Result<()> { // Already posted this week. return Ok(()); } + File::create(&now_path) + .await + .with_context(|| anyhow!("Failed to create {now_path:?}"))?; let mut date = now.date(); for _ in 1..=5 { @@ -56,9 +59,6 @@ async fn tick(config: &HandlerConfig, ctx: &Context) -> Result<()> { } } - File::create(&now_path) - .await - .with_context(|| anyhow!("Failed to create {now_path:?}"))?; Ok(()) } -- cgit v1.2.3