← Back to PRs

#10095: Add rate limiting to probeFeishu function

by Cotch22 open 2026-02-06 03:46 View on GitHub →
channel: feishu stale
Implement rate limiting for the probe function to avoid hitting API limits. ----- This pull request introduces a rate-limiting mechanism to the `probeFeishu` function in the Feishu extension. The main change ensures that the probe operation is not executed more than once every 24 hours, helping to avoid hitting external rate limits. Rate limiting enhancements: * Added a `lastProbeAt` variable and logic to skip the probe if it was run within the last 24 hours, returning an error message when skipped. (`extensions/feishu/src/probe.ts`) ----- <img width="347" height="255" alt="image" src="https://github.com/user-attachments/assets/cd5e2127-765a-47d6-a6c7-c4616edf1816" /> Lark limits API calls to 10,000 per month when not in use. Polling the Probe every minute is very wasteful of calls, so it's limited to once a day. WebSocket persistent connections are unaffected. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds an in-memory rate limiter to `probeFeishu` (`extensions/feishu/src/probe.ts`) by tracking a module-level `lastProbeAt` timestamp and skipping calls made within a 24-hour window, returning an error message instead of hitting the Feishu/Lark API. The intent is to reduce external API usage when the probe is polled frequently, without affecting WebSocket/persistent connections. <h3>Confidence Score: 3/5</h3> - This PR is not safe to merge as-is due to a rate-limiting logic bug that can prevent probes from ever running again under frequent polling. - The change is small and localized, but updating `lastProbeAt` in the skip branch turns the intended fixed 24h limit into a sliding window that can permanently suppress real probes in common polling scenarios; additionally, treating an intentional skip as `{ ok: false }` risks breaking caller behavior. - extensions/feishu/src/probe.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs