blob: 2a5f9c9dbbcb6ac20088dc330a73ff3c8362a067 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
module Goldiloader
module AssociationLoader
module LimitPreloading
PreloadingLimitExceeded = Class.new(StandardError)
private
def eager_load(models, association_name)
if Gitlab::Sentry.enabled? && models.count > 100
Gitlab::Sentry.context
Raven.capture_exception(PreloadingLimitExceeded.new("More than 100 models preloaded for #{models.first.class}.#{association_name}"))
return
end
super
rescue => e
Raven.capture_exception(e)
end
end
prepend LimitPreloading
singleton_class.prepend LimitPreloading
end
end
|