diff options
Diffstat (limited to 'app/services/projects')
4 files changed, 19 insertions, 10 deletions
diff --git a/app/services/projects/autocomplete_service.rb b/app/services/projects/autocomplete_service.rb index ae5aae87a77..11437ad90fc 100644 --- a/app/services/projects/autocomplete_service.rb +++ b/app/services/projects/autocomplete_service.rb @@ -23,7 +23,7 @@ module Projects MergeRequestsFinder.new(current_user, project_id: project.id, state: 'opened').execute.select([:iid, :title]) end - def commands(noteable, type) + def commands(noteable) return [] unless noteable && current_user QuickActions::InterpretService.new(project, current_user).available_commands(noteable) diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index a4b473f35c6..d3313526eaf 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -22,6 +22,12 @@ module Projects end def execute + params[:wiki_enabled] = params[:wiki_access_level] if params[:wiki_access_level] + params[:builds_enabled] = params[:builds_access_level] if params[:builds_access_level] + params[:snippets_enabled] = params[:builds_access_level] if params[:snippets_access_level] + params[:merge_requests_enabled] = params[:merge_requests_access_level] if params[:merge_requests_access_level] + params[:issues_enabled] = params[:issues_access_level] if params[:issues_access_level] + if create_from_template? return ::Projects::CreateFromTemplateService.new(current_user, params).execute end diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index 967a1e990b2..e6ccae0a22b 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -166,7 +166,7 @@ module Projects .then do |(import_url, resolved_host)| next '' if resolved_host.nil? || !import_url.scheme.in?(%w[http https]) - import_url.host.to_s + import_url.hostname.to_s end end diff --git a/app/services/projects/refresh_build_artifacts_size_statistics_service.rb b/app/services/projects/refresh_build_artifacts_size_statistics_service.rb index 8e006dc8c34..f11083d6c04 100644 --- a/app/services/projects/refresh_build_artifacts_size_statistics_service.rb +++ b/app/services/projects/refresh_build_artifacts_size_statistics_service.rb @@ -2,28 +2,31 @@ module Projects class RefreshBuildArtifactsSizeStatisticsService - BATCH_SIZE = 1000 + BATCH_SIZE = 500 + REFRESH_INTERVAL_SECONDS = 0.1 def execute refresh = Projects::BuildArtifactsSizeRefresh.process_next_refresh! - return unless refresh + + return unless refresh&.running? batch = refresh.next_batch(limit: BATCH_SIZE).to_a if batch.any? - # We are doing the sum in ruby because the query takes too long when done in SQL - total_artifacts_size = batch.sum { |artifact| artifact.size.to_i } + increments = batch.map do |artifact| + Gitlab::Counters::Increment.new(amount: artifact.size.to_i, ref: artifact.id) + end Projects::BuildArtifactsSizeRefresh.transaction do # Mark the refresh ready for another worker to pick up and process the next batch refresh.requeue!(batch.last.id) - refresh.project.statistics.increment_counter(:build_artifacts_size, total_artifacts_size) + ProjectStatistics.bulk_increment_statistic(refresh.project, :build_artifacts_size, increments) end + + sleep REFRESH_INTERVAL_SECONDS else - # Remove the refresh job from the table if there are no more - # remaining job artifacts to calculate for the given project. - refresh.destroy! + refresh.schedule_finalize! end refresh |