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

[DEV] Fixing double logging of cache hits and misses #474

Merged
merged 2 commits into from
Jan 8, 2021
Merged

[DEV] Fixing double logging of cache hits and misses #474

merged 2 commits into from
Jan 8, 2021

Conversation

glebglazov
Copy link
Contributor

@glebglazov glebglazov commented Oct 11, 2020

Due to the fact that in Rails logger is extended to output to console and server respectively
https://github.com/rails/rails/blob/4cf7559/activerecord/lib/active_record/railtie.rb#L64
https://github.com/rails/rails/blob/4cf7559/railties/lib/rails/commands/server/server_command.rb#L85
there is a downside of using IdentityCache.logger.debug and calling it once again inside that block that results in duplication of logs:
image
This pull request fixes the problem by using guard-clause instead of wrapping the code in logger.debug call making it log only once:
image

@dylanahsmith dylanahsmith merged commit 27e9d27 into Shopify:master Jan 8, 2021
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems January 8, 2021 19:46 Inactive
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.

2 participants