Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(email-service): Only send delete messages once daily, during the night (#991)

Evan Hutnik183fb16dc2c0
diff --git a/rust/cloud-storage/email_refresh_handler/src/handler.rs b/rust/cloud-storage/email_refresh_handler/src/handler.rs
index 0adaf0559c..b8f30fab52 100644
--- a/rust/cloud-storage/email_refresh_handler/src/handler.rs
+++ b/rust/cloud-storage/email_refresh_handler/src/handler.rs
@@ -23,7 +23,13 @@ pub async fn handler(
_event: LambdaEvent<EventBridgeEvent>,
) -> Result<(), Error> {
if matches!(ctx.config.environment, Environment::Production) {
- tokio::try_join!(send_refresh_messages(&ctx), send_delete_messages(&ctx))?;
+ // only send delete messages once daily, during the night
+ let current_hour = chrono::Utc::now().hour();
+ if current_hour == 5 {
+ tokio::try_join!(send_refresh_messages(&ctx), send_delete_messages(&ctx))?;
+ } else {
+ send_refresh_messages(&ctx).await?;
+ }
} else {
send_refresh_messages(&ctx).await?;
}
diff --git a/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip b/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip
index a1b67fd7a9..e4e1b0e567 100644
Binary files a/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip and b/rust/cloud-storage/target/lambda/email_refresh_handler/bootstrap.zip differ