-
Notifications
You must be signed in to change notification settings - Fork 0
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
brige: fix refreshing cloud access token #452
Conversation
WalkthroughThe update introduces a more dynamic and efficient approach to managing token refresh intervals within a cloud bridge device management system. By defining a Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- bridge/device/cloud/manager.go (3 hunks)
Additional comments: 2
bridge/device/cloud/manager.go (2)
- 52-52: The introduction of the
tickInterval
constant is a good practice for maintainability and readability. It allows for easy adjustments and ensures consistency across the codebase.- 357-366: The modifications in the
isCredsExpiring
method to adjust the token refresh logic based on thetickInterval
are sound, ensuring that the token is refreshed with enough buffer time. Consider adding a comment explaining the logic behind refreshing the token when the remaining time is less than twice thetickInterval
or one-third before expiration for clarity.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #452 +/- ##
==========================================
- Coverage 76.83% 76.81% -0.02%
==========================================
Files 115 115
Lines 6699 6702 +3
==========================================
+ Hits 5147 5148 +1
- Misses 1014 1015 +1
- Partials 538 539 +1 ☔ View full report in Codecov by Sentry. |
2facd0c
to
532b77e
Compare
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- bridge/device/cloud/manager.go (3 hunks)
- bridge/device/cloud/signIn.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- bridge/device/cloud/manager.go
Additional comments: 1
bridge/device/cloud/signIn.go (1)
- 74-74: The addition of the condition to check for an empty
RefreshToken
upon receiving anUnauthorized
response code is a good security practice. It ensures that the device attempts to sign in only when it has valid credentials, preventing unnecessary or unauthorized access attempts.However, consider adding a comment explaining the rationale behind this condition for future maintainability.
Quality Gate passedIssues Measures |
Summary by CodeRabbit