fix(email-service): Notify search on label updates#635
Merged
evanhutnik merged 3 commits intomainfrom Dec 15, 2025
Merged
Conversation
| .fetch_optional(pool) | ||
| .await | ||
| .context("Failed to query messages for db_id")?; | ||
| .context("Failed to query message/thread id by provider id")?; |
whutchinson98
approved these changes
Dec 15, 2025
| Ok(db_ids) | ||
| match row { | ||
| Some((message_id, thread_id)) => Ok((message_id, thread_id)), | ||
| None => Err(anyhow!( |
| .into_iter() | ||
| .filter(|id| !existing_set.contains(id)) | ||
| .collect(); | ||
| .with_context(|| format!("Failed to check existing message for link_id {}", link_id))?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Originally we were only planning on using email search for content matches, so we only notified search when new messages were added to the database. Now we also include label information in opensearch. So we need to notify search whenever there is a label change to a message.
Sometimes gmail notifies us of label changes through an
UpsertMessagenotification, and sometimes through anUpdateLabelnotification. We now notify search if either event happens for a message.Also did some refactoring of upsert message code. Back in the day we were handling multiple email message updates in a single pubsub message. Now we only handle one email message update per message, so the logic can be simplified.
Screenshots, GIFs, and Videos