-
Notifications
You must be signed in to change notification settings - Fork 487
fix: excessive api pooling #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced a new `useEventRecency` hook to track the recency of WebSocket events, allowing for conditional polling based on event activity. - Updated `AgentInfoPanel` to utilize the new hook, adjusting polling intervals based on WebSocket activity. - Implemented debounced invalidation for auto mode events to optimize query updates during rapid event streams. - Added utility functions for managing event recency checks in various query hooks, improving overall responsiveness and reducing unnecessary polling. - Introduced debounce and throttle utilities for better control over function execution rates. This enhancement improves the application's performance by reducing polling when real-time updates are available, ensuring a more efficient use of resources.
Summary of ChangesHello @Shironex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances application performance and resource efficiency by intelligently managing API polling. Instead of constant polling, the system now prioritizes real-time WebSocket updates. When WebSocket activity is detected, polling is either reduced or disabled, and rapid event-driven query invalidations are debounced to prevent UI thrashing. This ensures a smoother user experience and reduces server load by fetching data only when necessary or when real-time streams are inactive. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request significantly improves the application's performance by introducing a new useEventRecency hook and debounced invalidation for query updates. The changes effectively reduce unnecessary API polling when real-time WebSocket events are active, leading to a more efficient use of resources. The new debounce and throttle utilities are well-implemented and thoroughly tested, providing robust rate-limiting capabilities. Overall, the changes are well-structured and address the stated objective of fixing excessive API polling.
apps/ui/src/components/views/board-view/components/kanban-card/agent-info-panel.tsx
Outdated
Show resolved
Hide resolved
Address PR review feedback: - Use WS_ACTIVITY_THRESHOLD constant instead of hardcoded 10000 in agent-info-panel.tsx - Extract AGENT_OUTPUT_POLLING_INTERVAL constant for 5000ms value in use-features.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tments - Bumped version from 0.12.0rc to 0.13.0 across the project. - Updated package-lock.json to reflect changes in dependencies, including marking certain dependencies as `devOptional`. - Adjusted import paths in the UI for better module organization. This update ensures consistency in versioning and improves the structure of utility imports.
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughThe PR introduces WebSocket activity tracking and smart polling mechanisms. A new event recency module with Zustand store tracks WebSocket event timestamps globally and per-query-key. Query hooks are modified to disable polling when recent WebSocket events are detected. A debounce utility is added to manage frequent invalidation updates, reducing unnecessary API calls during rapid WebSocket activity. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
useEventRecencyhook to track the recency of WebSocket events, allowing for conditional polling based on event activity.AgentInfoPanelto utilize the new hook, adjusting polling intervals based on WebSocket activity.This enhancement improves the application's performance by reducing polling when real-time updates are available, ensuring a more efficient use of resources.
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.