-
Notifications
You must be signed in to change notification settings - Fork 232
feat: add null check to github calls to prevent unwanted round-trips #2302
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
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/models/github_integration.rb (1)
166-168: Excellent optimization to prevent unnecessary API calls!The early return when GitHub credentials are not configured successfully prevents the expensive
check_github_authorizationcall, which aligns perfectly with the PR objective of reducing round-trip times.However, consider these optional style improvements for better Ruby idioms:
Apply this diff for more idiomatic Ruby style:
- return false if Rails.configuration.x.github.client_id.blank? or - Rails.configuration.x.github.client_secret.blank? + return false unless Rails.configuration.x.github.client_id.present? && + Rails.configuration.x.github.client_secret.present?Rationale:
- Ruby style guides recommend
||/&&for boolean operations;or/andare for control flow- Using
present?is more consistent with the existing codebase (e.g., line 64:access_token.present?)- The
unlessform reads more naturally for guard clauses
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/models/github_integration.rb(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test
- GitHub Check: lint
coder6583
left a comment
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.
LGTM
Description
an investigation of the insanely high loading times on many pages showed that Rails spents an unreasonable amount of time
making round-trip calls to github (for the context of submitting assignments through github integration)
Motivation and Context
How Has This Been Tested?
load times on the "submit assignment" page is drastically lower (often ~80ms faster at least, but many cases much faster)
other pages benefit from this simple fix too
Types of changes
Checklist:
overcommit --install && overcommit --signto use pre-commit hook for lintingOther issues / help required
If unsure, feel free to submit first and we'll help you along.