Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chore(email-service): Disable sfs mapping in prod for email backfill (#1890)
Evan Hutnik808fdff72beb
diff --git a/rust/cloud-storage/email_service/src/pubsub/backfill/backfill_message.rs b/rust/cloud-storage/email_service/src/pubsub/backfill/backfill_message.rsindex 5ee0b91a0d..1a5d386761 100644--- a/rust/cloud-storage/email_service/src/pubsub/backfill/backfill_message.rs+++ b/rust/cloud-storage/email_service/src/pubsub/backfill/backfill_message.rs@@ -59,7 +59,7 @@ pub async fn backfill_message(})})?;- process_message_pre_insert(&ctx.db, &ctx.sfs_client, &mut message).await;+ process_message_pre_insert(&mut message).await;// insert message into databaseemail_db_client::messages::insert::insert_message(diff --git a/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs b/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rsindex eb484a1fb6..0ec200e68a 100644--- a/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs+++ b/rust/cloud-storage/email_service/src/pubsub/inbox_sync/operations/upsert_message.rs@@ -405,7 +405,7 @@ async fn fetch_and_insert_thread(})?;// process threads- process_threads_pre_insert(&ctx.db, &ctx.sfs_client, &mut threads).await;+ process_threads_pre_insert(&mut threads).await;// insert threads into dbfor thread in threads.into_iter() {@@ -430,7 +430,7 @@ async fn process_and_insert_message(thread_db_id: Uuid,mut message: Message,) -> anyhow::Result<()> {- process_message_pre_insert(&ctx.db, &ctx.sfs_client, &mut message).await;+ process_message_pre_insert(&mut message).await;email_db_client::messages::insert::insert_message(&ctx.db,diff --git a/rust/cloud-storage/email_service/src/util/process_pre_insert/mod.rs b/rust/cloud-storage/email_service/src/util/process_pre_insert/mod.rsindex a394567aac..3d7d666a6d 100644--- a/rust/cloud-storage/email_service/src/util/process_pre_insert/mod.rs+++ b/rust/cloud-storage/email_service/src/util/process_pre_insert/mod.rs@@ -1,48 +1,21 @@use crate::util::process_pre_insert::clean_message::{clean_message, clean_threads};-use crate::util::process_pre_insert::sfs_map::{store_message_images, store_threads_images};-use macro_env::Environment;use models_email::email::service;-use static_file_service_client::StaticFileServiceClient;mod clean_message;pub mod sfs_map;pub mod sync_labels;// perform necessary processing on threads before inserting into the database-#[tracing::instrument(skip(db, sfs_client, threads))]-pub async fn process_threads_pre_insert(- db: &sqlx::PgPool,- sfs_client: &StaticFileServiceClient,- threads: &mut Vec<service::thread::Thread>,-) {- // store the linked images in messages in sfs, acting as a cdn (prod only)- if matches!(Environment::new_or_prod(), Environment::Production) {- store_threads_images(threads, db, sfs_client).await;- }-+#[tracing::instrument(skip(threads))]+pub async fn process_threads_pre_insert(threads: &mut Vec<service::thread::Thread>) {// clean threads contentclean_threads(threads);}// perform necessary processing on a message before inserting into the database-#[tracing::instrument(skip(db, sfs_client, message), fields(message_id = %message.provider_id.clone().unwrap_or_default()+#[tracing::instrument(skip(message), fields(message_id = %message.provider_id.clone().unwrap_or_default()))]-pub async fn process_message_pre_insert(- db: &sqlx::PgPool,- sfs_client: &StaticFileServiceClient,- message: &mut service::message::Message,-) {- // store the linked images in messages in sfs, acting as a cdn (prod only)- if matches!(Environment::new_or_prod(), Environment::Production)- && let Err(err) = store_message_images(db, sfs_client, message).await- {- tracing::warn!(- error = ?err,- message_provider_id = %message.provider_id.clone().unwrap_or_default(),- "Non-fatal error: Failed to store message images, but continuing processing."- );- }-+pub async fn process_message_pre_insert(message: &mut service::message::Message) {// clean message contentclean_message(message);}