fix(imap): deduplicate scan results on insertion#234
Merged
Userunknown84 merged 1 commit intoJun 24, 2026
Conversation
|
@devprashant19 is attempting to deploy a commit to the Aditya Sharma's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
🎉 Thank you for your first Pull Request!
We appreciate your contribution to the project.
Please ensure:
- Your code follows the project guidelines.
- All tests pass successfully.
- A clear description of the changes is provided.
A maintainer will review your PR shortly. 🚀
Userunknown84
approved these changes
Jun 24, 2026
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.
Description
This PR fixes a bug in
backend/email_connectors/imap_store.pywhere IMAP scan results were inserted blindly on every scan cycle. Because there was no deduplication, the same emails were re-inserted every time the inbox was scanned, causing the database table to grow indefinitely (~144,000 redundant rows per month per user on a 15-minute interval).Closes #223
Changes
save_scan_results()inimap_store.pyto first query the database for existingmessage_ids.scanned_emailslist to only executeINSERTstatements for emails that are not already present in the database.Related Issues
Type of Change
Pre-submission Checklist
imap_scan_results.