Skip to content

Bugfix/delete document tags slow#4232

Merged
Weves merged 5 commits intomainfrom
bugfix/delete-document-tags-slow
Mar 10, 2025
Merged

Bugfix/delete document tags slow#4232
Weves merged 5 commits intomainfrom
bugfix/delete-document-tags-slow

Conversation

@rkuo-danswer
Copy link
Copy Markdown
Contributor

Description

Fixes DAN-1543.
https://linear.app/danswer/issue/DAN-1543/slow-doc-tag-deletion-contributor

Credit to @ThomaciousD - #4192

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2025 0:56am

@rkuo-danswer rkuo-danswer marked this pull request as ready for review March 7, 2025 19:57
@rkuo-danswer rkuo-danswer requested a review from a team as a code owner March 7, 2025 19:57
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR optimizes document tag deletion performance and modifies email header handling, with key changes focused on query efficiency and email configuration.

  • Improved orphan tag deletion in /backend/onyx/db/tag.py by replacing outer join/group by with a more efficient NOT EXISTS subquery
  • Added conditional 'From' header check in /backend/onyx/auth/email_utils.py that needs review as missing headers could cause email delivery failures
  • Query optimization removes dependency on SQLAlchemy's func module while maintaining correct tag identification

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +156 to +157
if mail_from:
msg["From"] = mail_from
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Removing the 'From' header when mail_from is None will cause email delivery failures. The 'From' header is required by SMTP. Should use EMAIL_FROM as fallback instead.

Suggested change
if mail_from:
msg["From"] = mail_from
msg["From"] = mail_from or EMAIL_FROM

@Weves Weves added this pull request to the merge queue Mar 10, 2025
Merged via the queue into main with commit 6ca400c Mar 10, 2025
9 of 10 checks passed
@rkuo-danswer rkuo-danswer deleted the bugfix/delete-document-tags-slow branch March 24, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants