diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-12-13 20:26:56 +0100 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2019-02-27 11:52:35 +0100 |
commit | 5ae9a44aa17c8929627cc450f936cd960c143e25 (patch) | |
tree | 6a14d388f5687979a683d443868b4297ebc6838c /app/workers | |
parent | 6fa88ed77e1693cda845efe49bf2c9a77aed2e4f (diff) | |
download | gitlab-ce-5ae9a44aa17c8929627cc450f936cd960c143e25.tar.gz |
Add project http fetch statistics API
The API get projects/:id/traffic/fetches allows user with write
access to the repository to get the number of clones for the
last 30 days.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 1 | ||||
-rw-r--r-- | app/workers/project_daily_statistics_worker.rb | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index d0fc130b04f..337f39b2091 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -146,3 +146,4 @@ - repository_cleanup - delete_stored_files - import_issues_csv +- project_daily_statistics diff --git a/app/workers/project_daily_statistics_worker.rb b/app/workers/project_daily_statistics_worker.rb new file mode 100644 index 00000000000..101f5c28459 --- /dev/null +++ b/app/workers/project_daily_statistics_worker.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class ProjectDailyStatisticsWorker + include ApplicationWorker + + def perform(project_id) + project = Project.find_by_id(project_id) + + return unless project&.repository&.exists? + + Projects::FetchStatisticsIncrementService.new(project).execute + end +end |