Skip to content
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

feat(region): more debug logs #1007

Merged
merged 4 commits into from
Sep 22, 2023
Merged

feat(region): more debug logs #1007

merged 4 commits into from
Sep 22, 2023

Conversation

EtienneM
Copy link
Member

@EtienneM EtienneM commented Sep 18, 2023

Fix #866

This may help debug #809.

  • Add a changelog entry in the section "To Be Released" of CHANGELOG.md

@EtienneM EtienneM self-assigned this Sep 18, 2023
@EtienneM EtienneM marked this pull request as ready for review September 18, 2023 11:59
Comment on lines +55 to +57
if err != nil {
debug.Printf("[Regions] Fail to open the cache: %v\n", err)
} else {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are more used to check err != nil in Go. So I'm refactoring to use this pattern here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why don't we use defer fd.Close()?
It seems more secure IMO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. Maybe it's useless in this case to wait longer before closing the file descriptor: we decode its content then immediately close it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Then 👌

Comment on lines +108 to 111
if err != nil {
debug.Printf("[Regions] Failed to save the cache: %v\n", err)
return regionsCache, nil
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are more used to check err != nil in Go. So I'm refactoring to use this pattern here.

Comment on lines +55 to +57
if err != nil {
debug.Printf("[Regions] Fail to open the cache: %v\n", err)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why don't we use defer fd.Close()?
It seems more secure IMO.

Copy link
Member

@brandon-welsch brandon-welsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ipfaze ipfaze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@EtienneM EtienneM merged commit 9bb4cba into master Sep 22, 2023
5 checks passed
@EtienneM EtienneM deleted the fix/866/debug_logs_cache branch September 22, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more debug logs on region cache system
3 participants