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

use find_each instead of each #360

Merged
merged 5 commits into from
Mar 28, 2024
Merged

use find_each instead of each #360

merged 5 commits into from
Mar 28, 2024

Conversation

chrisbendel
Copy link
Collaborator

No description provided.

@@ -33,7 +33,7 @@ def build_headers(csv)
end

def get_users(launches)
launches.each do |launch|
launches.find_each do |launch|
Copy link
Member

Choose a reason for hiding this comment

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

since all we're reading is the user_id we could use pluck

Suggested change
launches.find_each do |launch|
@user_uuids = launches.clone.pluck('user_id')

The clone is needed because launches is a query that's also used below, so we create a clone before executing it.

@chrisbendel chrisbendel merged commit a24db36 into main Mar 28, 2024
4 checks passed
@chrisbendel chrisbendel deleted the memory-usage-fixes branch March 28, 2024 18:58
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