diff options
author | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-01 11:34:24 +0100 |
---|---|---|
committer | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-01 18:32:13 +0100 |
commit | c5a89b35f0d43b54df8767522428a006770673ac (patch) | |
tree | 12cb81f073420b002ea875ea99658f8fe0556773 | |
parent | 3dc331c6131040b8c2a0e682c34e5a19c803e000 (diff) | |
download | gitlab-ce-c5a89b35f0d43b54df8767522428a006770673ac.tar.gz |
Using map to retrieve the element ids because of some issues with mysql
-rw-r--r-- | app/services/projects/batch_count_service.rb | 5 | ||||
-rw-r--r-- | app/services/projects/batch_forks_count_service.rb | 4 | ||||
-rw-r--r-- | app/services/projects/batch_open_issues_count_service.rb | 4 |
3 files changed, 9 insertions, 4 deletions
diff --git a/app/services/projects/batch_count_service.rb b/app/services/projects/batch_count_service.rb index a79fdb62d69..178ebc5a143 100644 --- a/app/services/projects/batch_count_service.rb +++ b/app/services/projects/batch_count_service.rb @@ -1,3 +1,6 @@ +# Service class for getting and caching the number of elements of several projects +# Warning: do not user this service with a really large set of projects +# because the service use maps to retrieve the project ids. module Projects class BatchCountService def initialize(projects) @@ -14,8 +17,6 @@ module Projects end def project_ids - return @projects if @projects.is_a?(ActiveRecord::Relation) - @projects.map(&:id) end diff --git a/app/services/projects/batch_forks_count_service.rb b/app/services/projects/batch_forks_count_service.rb index b9ed0b3cf4f..e61fe6c86b2 100644 --- a/app/services/projects/batch_forks_count_service.rb +++ b/app/services/projects/batch_forks_count_service.rb @@ -1,5 +1,7 @@ +# Service class for getting and caching the number of forks of several projects +# Warning: do not user this service with a really large set of projects +# because the service use maps to retrieve the project ids module Projects - # Service class for getting and caching the number of forks of several projects class BatchForksCountService < Projects::BatchCountService def global_count @global_count ||= begin diff --git a/app/services/projects/batch_open_issues_count_service.rb b/app/services/projects/batch_open_issues_count_service.rb index 5087684863b..3b0ade2419b 100644 --- a/app/services/projects/batch_open_issues_count_service.rb +++ b/app/services/projects/batch_open_issues_count_service.rb @@ -1,5 +1,7 @@ +# Service class for getting and caching the number of issues of several projects +# Warning: do not user this service with a really large set of projects +# because the service use maps to retrieve the project ids module Projects - # Service class for getting and caching the number of forks of several projects class BatchOpenIssuesCountService < Projects::BatchCountService def global_count @global_count ||= begin |