Class: Projects::UpdateStatisticsService

Inherits:
BaseService show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/projects/update_statistics_service.rb

Constant Summary collapse

STAT_TO_CACHED_METHOD =
{
  repository_size: [:size, :recent_objects_size],
  commit_count: :commit_count
}.freeze

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseService

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
# File 'app/services/projects/update_statistics_service.rb', line 12

def execute
  return unless project

  Gitlab::AppLogger.info("Updating statistics for project #{project.id}")

  expire_repository_caches
  expire_wiki_caches
  project.statistics.refresh!(only: statistics)
end