-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Closed
Description
Description
The Feishu plugin currently calls the /open-apis/bot/v3/info API every minute during the Gateway health check (defined in probeFeishu). For bots running long-term or across multiple accounts, this triggers unnecessary network traffic and risks hitting Feishu's API rate limits.
When the network is unstable (e.g., 504 Gateway Timeout), the probe can hang or repeatedly fail, leading to unnecessary log noise and potential performance issues for the Gateway.
Suggested Fix
Implement a dual-TTL caching mechanism in src/probe.ts:
- Success Cache: 24 hours (Bot info rarely changes).
- Error Cache: 1 minute (Prevent hammering during temporary outages but allow quick recovery).
- Timeout: Add a 10s timeout to the probe request to prevent hanging.
Code Reference (Tested Solution)
// Proposed logic for src/probe.ts
const PROBE_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
const PROBE_ERROR_TTL_MS = 60 * 1000;
const probeCache = new Map<string, { result: any; timestamp: number }>();
export async function probeFeishu(creds?: any) {
// 1. Check Cache
const cacheKey = `${creds.appId}:${creds.domain}`;
const cached = probeCache.get(cacheKey);
if (cached) {
const ttl = cached.result.ok ? PROBE_CACHE_TTL_MS : PROBE_ERROR_TTL_MS;
if (Date.now() - cached.timestamp < ttl) return cached.result;
}
// 2. Request with Timeout
try {
const client = createFeishuClient(creds);
const response = await (client as any).request({
method: "GET",
url: "/open-apis/bot/v3/info",
params: {},
timeout: 10000
});
// ... cache and return
} catch (err) {
// ... cache error for 1 min
}
}Environment
- OpenClaw Version: v2026.2.25
- Plugin: Feishu/Lark
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels