惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
The Cloudflare Blog
IT之家
IT之家
V
V2EX
雷峰网
雷峰网
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
云风的 BLOG
云风的 BLOG
小众软件
小众软件
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
C
Check Point Blog
A
About on SuperTechFans
B
Blog
月光博客
月光博客
宝玉的分享
宝玉的分享
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
perf(slack): cache stream recipient team lookup · opencla...
vincentkoc · 2026-05-07 · via Recent Commits to openclaw:main

@@ -177,6 +177,9 @@ type SlackTurnDeliveryAttempt = {

177177

textOverride?: string;

178178

};

179179180+

const SLACK_STREAM_RECIPIENT_TEAM_CACHE_MAX = 2000;

181+

const slackStreamRecipientTeamCache = new Map<string, string>();

182+180183

function buildSlackTurnDeliveryKey(params: SlackTurnDeliveryAttempt): string | null {

181184

const reply = resolveSendableOutboundReplyParts(params.payload, {

182185

text: params.textOverride,

@@ -195,6 +198,48 @@ function buildSlackTurnDeliveryKey(params: SlackTurnDeliveryAttempt): string | n

195198

});

196199

}

197200201+

function readSlackStreamRecipientTeamCache(params: {

202+

fallbackTeamId?: string;

203+

userId?: string;

204+

}): string | undefined {

205+

if (!params.fallbackTeamId || !params.userId) {

206+

return undefined;

207+

}

208+

const cacheKey = `${params.fallbackTeamId}:${params.userId}`;

209+

const cached = slackStreamRecipientTeamCache.get(cacheKey);

210+

if (!cached) {

211+

return undefined;

212+

}

213+

slackStreamRecipientTeamCache.delete(cacheKey);

214+

slackStreamRecipientTeamCache.set(cacheKey, cached);

215+

return cached;

216+

}

217+218+

function rememberSlackStreamRecipientTeam(params: {

219+

fallbackTeamId?: string;

220+

userId?: string;

221+

teamId: string;

222+

}): void {

223+

if (!params.fallbackTeamId || !params.userId) {

224+

return;

225+

}

226+

const cacheKey = `${params.fallbackTeamId}:${params.userId}`;

227+

if (slackStreamRecipientTeamCache.has(cacheKey)) {

228+

slackStreamRecipientTeamCache.delete(cacheKey);

229+

}

230+

slackStreamRecipientTeamCache.set(cacheKey, params.teamId);

231+

if (slackStreamRecipientTeamCache.size > SLACK_STREAM_RECIPIENT_TEAM_CACHE_MAX) {

232+

const oldest = slackStreamRecipientTeamCache.keys().next().value;

233+

if (oldest) {

234+

slackStreamRecipientTeamCache.delete(oldest);

235+

}

236+

}

237+

}

238+239+

export function resetSlackStreamRecipientTeamCacheForTests(): void {

240+

slackStreamRecipientTeamCache.clear();

241+

}

242+198243

export function createSlackTurnDeliveryTracker() {

199244

const deliveredKeys = new Set<string>();

200245

return {

@@ -231,6 +276,10 @@ export async function resolveSlackStreamRecipientTeamId(params: {

231276

userId?: PreparedSlackMessage["message"]["user"];

232277

fallbackTeamId?: string;

233278

}): Promise<string | undefined> {

279+

const cachedTeamId = readSlackStreamRecipientTeamCache(params);

280+

if (cachedTeamId) {

281+

return cachedTeamId;

282+

}

234283

if (params.userId) {

235284

try {

236285

const info = await params.client.users.info({

@@ -239,6 +288,7 @@ export async function resolveSlackStreamRecipientTeamId(params: {

239288

});

240289

const teamId = info.user?.team_id ?? info.user?.profile?.team;

241290

if (teamId) {

291+

rememberSlackStreamRecipientTeam({ ...params, teamId });

242292

return teamId;

243293

}

244294

} catch (err) {