Commit dc130b9c authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Do not replace methods of BatchLoader proxy objects

When the `replace_methods` option of BatchLoader#batch method is not
set as `false`, the gem is defining all the instance methods of loaded
object for the proxy instance of BatchLoader which can actually be an
order of magnitude slower than just falling back to `method_missing`.

Here we are setting `replace_methods` as false to disable this odd
behaviour.
parent 49e826af
...@@ -190,7 +190,7 @@ module Vulnerabilities ...@@ -190,7 +190,7 @@ module Vulnerabilities
end end
def load_feedback def load_feedback
BatchLoader.for(occurrence_key).batch do |occurrence_keys, loader| BatchLoader.for(occurrence_key).batch(replace_methods: false) do |occurrence_keys, loader|
project_ids = occurrence_keys.map { |key| key[:project_id] } project_ids = occurrence_keys.map { |key| key[:project_id] }
categories = occurrence_keys.map { |key| key[:category] } categories = occurrence_keys.map { |key| key[:category] }
fingerprints = occurrence_keys.map { |key| key[:project_fingerprint] } fingerprints = occurrence_keys.map { |key| key[:project_fingerprint] }
......
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