-
Notifications
You must be signed in to change notification settings - Fork 19
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
FIX: N1 in post action extension #292
Conversation
plugin.rb
Outdated
@@ -104,6 +104,20 @@ class Engine < ::Rails::Engine | |||
|
|||
reaction_users_counting_as_like.flatten! | |||
|
|||
# Used to remove historical like data in the filter below. | |||
previous_main_reaction_like_ids = |
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.
We can potentially add a spec using track_sql_queries
for this, but since this is one of many add_to_serializer
modifications to the PostSerializer
, it's not really possible to do a clean before/after comparison without some more extensive refactoring, which I do not think is worth it at this time. Confirmed that the N1 is now gone locally.
Followup 0b4b186 The previous commit caused an N1 because I was calling post_action.reaction_user in a loop, which was making a query for every Like PostAction attached to a Post.
1e0844f
to
f6a847a
Compare
ece718c
to
46284bf
Compare
46284bf
to
88b849c
Compare
Followup 0b4b186
The previous commit caused an N1 because I was calling
post_action.reaction_user in a loop, which was making
a query for every Like PostAction attached to a Post.