8000 feat(cdp): cache slack channel responses by MarconLP · Pull Request #33583 · PostHog/posthog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(cdp): cache slack channel responses #33583

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

Merged
merged 5 commits into from
Jun 12, 2025
Merged

Conversation

MarconLP
Copy link
Member
@MarconLP MarconLP commented Jun 12, 2025

Important

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Problem

We are starting to get some rate limit issues when trying to fetch Slack channels
https://us.posthog.com/project/2/error_tracking/6e6650b3-7b15-4396-a6d7-70c38fb035de

Usually it's a single customer who is trying to configure multiple Slack destinations for a single workspace (insight).

Changes

Inspired by Zapier

2025-06-12 at 10 35 18@2x

2025-06-12 at 12 21 19

  • Cache Slack channels response (60 min)
    • do not cache the response when searching for a specific channel id
  • Add a button to force refresh the cache (once per 5 min)

Did you write or update any docs for this change?

How did you test this code?

Copy link
Contributor
github-actions bot commented Jun 12, 2025

Size Change: +29 B (0%)

Total Size: 1.83 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.83 MB +29 B (0%)

compressed-size-action

@MarconLP MarconLP marked this pull request as ready for review June 12, 2025 10:37
Copy link
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

Implements caching for Slack channel responses to prevent rate limiting issues when users configure multiple Slack destinations for a single workspace.

  • Added 60-minute caching for Slack channel lists in posthog/api/integration.py while keeping channel-specific lookups uncached
  • Added new action feature in frontend/src/lib/lemon-ui/LemonInputSelect to support 'Refresh channels' button with 5-minute cooldown
  • Updated frontend/src/lib/integrations/slackIntegrationLogic.ts to include lastRefreshedAt timestamp and forceRefresh parameter
  • Modified frontend/src/lib/api.ts to handle cache control via forceRefresh parameter and return timing information
  • Implemented cache isolation by integration ID and private channel access state

5 files reviewed, 5 comments
Edit PR Review Bot Settings | Greptile

@MarconLP MarconLP requested a review from a team June 12, 2025 10:57
Copy link
Contributor
@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

This is really nice. Way more full-featured than I would have done 😅 🙌

@MarconLP MarconLP merged commit 6f55421 into master Jun 12, 2025
99 checks passed
@MarconLP MarconLP deleted the slack-rate-limiting-issue branch June 12, 2025 12:17
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
0