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

推荐订阅源

WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
D
DataBreaches.Net
腾讯CDC
V
Visual Studio Blog
博客园 - 叶小钗
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
有赞技术团队
有赞技术团队
U
Unit 42
博客园 - 司徒正美
博客园 - 聂微东

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(telegram): bound forum metadata cache · openclaw/ope...
obviyus · 2026-04-23 · via Recent Commits to openclaw:main

@@ -40,7 +40,26 @@ export {

4040

};

41414242

const TELEGRAM_GENERAL_TOPIC_ID = 1;

43-

const telegramForumFlagByChatId = new Map<string, boolean>();

43+

const TELEGRAM_FORUM_FLAG_CACHE_MAX_CHATS = 1024;

44+

const TELEGRAM_FORUM_FLAG_CACHE_TTL_MS = 10 * 60_000;

45+

const telegramForumFlagByChatId = new Map<string, { expiresAtMs: number; isForum: boolean }>();

46+47+

function cacheTelegramForumFlag(chatId: string | number, isForum: boolean, nowMs = Date.now()) {

48+

const cacheKey = String(chatId);

49+

if (

50+

!telegramForumFlagByChatId.has(cacheKey) &&

51+

telegramForumFlagByChatId.size >= TELEGRAM_FORUM_FLAG_CACHE_MAX_CHATS

52+

) {

53+

const oldestKey = telegramForumFlagByChatId.keys().next().value;

54+

if (oldestKey !== undefined) {

55+

telegramForumFlagByChatId.delete(oldestKey);

56+

}

57+

}

58+

telegramForumFlagByChatId.set(cacheKey, {

59+

expiresAtMs: nowMs + TELEGRAM_FORUM_FLAG_CACHE_TTL_MS,

60+

isForum,

61+

});

62+

}

44634564

function hadUnsafeTelegramText(raw: unknown, sanitized: string): boolean {

4665

return typeof raw === "string" && raw.trim().length > 0 && sanitized.trim().length === 0;

@@ -67,19 +86,26 @@ export async function resolveTelegramForumFlag(params: {

6786

getChat?: TelegramGetChat;

6887

}): Promise<boolean> {

6988

if (typeof params.isForum === "boolean") {

89+

if (params.isGroup && params.chatType === "supergroup") {

90+

cacheTelegramForumFlag(params.chatId, params.isForum);

91+

}

7092

return params.isForum;

7193

}

7294

if (!params.isGroup || params.chatType !== "supergroup" || !params.getChat) {

7395

return false;

7496

}

7597

const cacheKey = String(params.chatId);

98+

const nowMs = Date.now();

7699

const cached = telegramForumFlagByChatId.get(cacheKey);

77-

if (cached !== undefined) {

78-

return cached;

100+

if (cached && cached.expiresAtMs > nowMs) {

101+

return cached.isForum;

102+

}

103+

if (cached) {

104+

telegramForumFlagByChatId.delete(cacheKey);

79105

}

80106

try {

81107

const resolved = extractTelegramForumFlag(await params.getChat(params.chatId)) === true;

82-

telegramForumFlagByChatId.set(cacheKey, resolved);

108+

cacheTelegramForumFlag(params.chatId, resolved, nowMs);

83109

return resolved;

84110

} catch {

85111

return false;