summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2025-02-23 00:03:28 -0600
committerNathan Ringo <nathan@remexre.com>2025-02-23 00:03:28 -0600
commit71470840422a62f5bba5baeee960844231b41b78 (patch)
tree9f46b5b27956035978f9abd1fad6ebb078e5fa8d
parent82849b062d180cc7e2061df78236c9073581af5a (diff)
Fix locking logic to avoid spamming the channel when the Discord API is slow.HEADtrunk
-rw-r--r--src/labwatch.rs6
1 files 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(())
}