Commit 7b859843 authored by Harsh Chouraria's avatar Harsh Chouraria

Use find_each for better performance

The use of model.all.each would cause the console to pull in all records
into memory (as an array) which will either appear as a very slow
operation or one that fails after a certain limit of memory is reached
(killing the console)

This change updates a specific troubleshooting snippet that was using
model.all.each call

The change does not break the snippet's original
goals, just makes it use
fewer machine resources
parent 6d2092a7
......@@ -286,7 +286,7 @@ To delete these references to missing local artifacts (`job.log` files):
```ruby
artifacts_deleted = 0
::Ci::JobArtifact.all.each do |artifact| ### Iterate artifacts
::Ci::JobArtifact.find_each do |artifact| ### Iterate artifacts
# next if artifact.file.filename != "job.log" ### Uncomment if only `job.log` files' references are to be processed
next if artifact.file.exists? ### Skip if the file reference is valid
artifacts_deleted += 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment