-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix:ActiveRecord::QueryCanceled #5921 #5944
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughA new Rails migration is introduced to add a concurrent composite index on the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Possibly related issues
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Fixes #5921
Describe the changes you have made in this PR -
Application was facing this issue : PG::QueryCanceled: ERROR: canceling statement due to statement timeout
This issue was coming from CircuitVerse/app/controllers/projects_controller.rb line 31 that is
"if current_visit && !Ahoy::Event.exists?(visit_id: current_visit.id, name: "Visited project #{@project.id}")"
The query was slow because the ahoy_events table was missing an index on the combination of visit_id and name , which led PostgreSQL to scan the entire database resulting in timeout.
I added a database index on the ahoy_events table for the columns visit_id and name, using a non-blocking migration which improves query performance
Screenshots of the UI changes (If any) -
Checklist before requesting a review
Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.
Summary by CodeRabbit