Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slackbot optimization #3696

Merged
merged 11 commits into from
Jan 20, 2025
Merged

Slackbot optimization #3696

merged 11 commits into from
Jan 20, 2025

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Jan 17, 2025

Description

Fixes https://linear.app/danswer/issue/DAN-1275/slack-bot-not-working-with-on-our-cloud

Fixes cloud slackbot "acquiring" many tenants

  • Centralize removal logic
  • Use self.tenant_ids to track genuinely active tenants - only consider tenants with slackbots "active"

How Has This Been Tested?

  • Single tenant + multiple slackbots
  • Multi tenant + multiple Slackbots + delete slackbots

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)

Copy link

vercel bot commented Jan 17, 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 Jan 20, 2025 7:18pm

Copy link
Contributor

@rkuo-danswer rkuo-danswer left a comment

Choose a reason for hiding this comment

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

General comment in glancing through the code ... would think about reducing the class member side effects of some of these methods ... if the functions can be made pure by adding just one or a few parameters and/or returning state, we should do that where possible to make it easier to reason through.

@@ -252,42 +268,111 @@ def acquire_tenants(self) -> None:
ex=TENANT_LOCK_EXPIRATION,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should add comments to this to help explain how the lock is being used.

For the above lock, why manually set the lock vs using the lock class? it's a lot more error prone to have to handle the lock manually. Are we persisting the lock across runs? When does it get deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great point- inherited but 100% agree re lock stability / use

backend/onyx/onyxbot/slack/listener.py Show resolved Hide resolved
backend/onyx/onyxbot/slack/listener.py Outdated Show resolved Hide resolved
backend/onyx/onyxbot/slack/listener.py Outdated Show resolved Hide resolved
backend/onyx/onyxbot/slack/listener.py Show resolved Hide resolved
backend/onyx/onyxbot/slack/listener.py Show resolved Hide resolved
backend/onyx/onyxbot/slack/listener.py Outdated Show resolved Hide resolved
@pablonyx pablonyx added this pull request to the merge queue Jan 20, 2025
Merged via the queue into main with commit cc4953b Jan 20, 2025
13 of 14 checks passed
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.

2 participants