Skip to content

Comments

fix: use cached user list in /check instead of per-member GetUserInfo calls#64

Draft
Copilot wants to merge 2 commits intocodex/fix-ticket-prefix-dedupefrom
copilot/sub-pr-63
Draft

fix: use cached user list in /check instead of per-member GetUserInfo calls#64
Copilot wants to merge 2 commits intocodex/fix-ticket-prefix-dedupefrom
copilot/sub-pr-63

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

handleListMissing was calling api.GetUserInfo(uid) once per team member on every /check invocation — N serial Slack API calls adding latency and rate-limit exposure proportional to team size.

Changes

  • handleListMissing: Replace the per-member api.GetUserInfo loop with a single getCachedUsers(api) call (5-minute TTL cache) before the loop, then build an id→slack.User map for O(1) lookups per member.
  • Error handling: Log getCachedUsers failures rather than silently discarding the error; gracefully degrades by displaying raw Slack IDs when the cache call fails.
// Before: N API calls inside loop
for _, uid := range memberIDs {
    user, err := api.GetUserInfo(uid)  // one round-trip per member
    ...
}

// After: 1 cached call + map lookup
cachedUsers, err := getCachedUsers(api)  // served from cache after first call
userByID := buildUserMap(cachedUsers)
for _, uid := range memberIDs {
    u, found := userByID[uid]  // O(1)
    ...
}

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…dleListMissing

Co-authored-by: WZ <719869+WZ@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback on improving /check and preserving report statuses fix: use cached user list in /check instead of per-member GetUserInfo calls Feb 21, 2026
Copilot AI requested a review from WZ February 21, 2026 10:39
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