Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2018-12-13 22:26:56 +0300
committerJacopo <beschi.jacopo@gmail.com>2019-02-27 13:52:35 +0300
commit5ae9a44aa17c8929627cc450f936cd960c143e25 (patch)
tree6a14d388f5687979a683d443868b4297ebc6838c /app/workers
parent6fa88ed77e1693cda845efe49bf2c9a77aed2e4f (diff)
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.yml1
-rw-r--r--app/workers/project_daily_statistics_worker.rb13
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