diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-25 13:26:12 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-05-25 13:26:12 +0000 |
commit | 1ed7b7629a2c0fbcdfeeda386ec6292e57728e74 (patch) | |
tree | 4cd07f47a698bedf1a5811480482bfaa1582a5ae /app/workers | |
parent | 78de1c059ac588df4ba1ef352b28e5b1c6102804 (diff) | |
parent | 330789c23c777d8ca646eba7c25f39cb7342cdee (diff) | |
download | gitlab-ce-1ed7b7629a2c0fbcdfeeda386ec6292e57728e74.tar.gz |
Merge branch '17848-web-hook-logging' into 'master'
Implement Web Hooks calls logging
Closes #17848
See merge request !11027
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/remove_old_web_hook_logs_worker.rb | 10 | ||||
-rw-r--r-- | app/workers/system_hook_worker.rb | 10 | ||||
-rw-r--r-- | app/workers/web_hook_worker.rb (renamed from app/workers/project_web_hook_worker.rb) | 6 |
3 files changed, 14 insertions, 12 deletions
diff --git a/app/workers/remove_old_web_hook_logs_worker.rb b/app/workers/remove_old_web_hook_logs_worker.rb new file mode 100644 index 00000000000..555e1bb8691 --- /dev/null +++ b/app/workers/remove_old_web_hook_logs_worker.rb @@ -0,0 +1,10 @@ +class RemoveOldWebHookLogsWorker + include Sidekiq::Worker + include CronjobQueue + + WEB_HOOK_LOG_LIFETIME = 2.days + + def perform + WebHookLog.destroy_all(['created_at < ?', Time.now - WEB_HOOK_LOG_LIFETIME]) + end +end diff --git a/app/workers/system_hook_worker.rb b/app/workers/system_hook_worker.rb deleted file mode 100644 index 55d4e7d6dab..00000000000 --- a/app/workers/system_hook_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class SystemHookWorker - include Sidekiq::Worker - include DedicatedSidekiqQueue - - sidekiq_options retry: 4 - - def perform(hook_id, data, hook_name) - SystemHook.find(hook_id).execute(data, hook_name) - end -end diff --git a/app/workers/project_web_hook_worker.rb b/app/workers/web_hook_worker.rb index d973e662ff2..ad5ddf02a12 100644 --- a/app/workers/project_web_hook_worker.rb +++ b/app/workers/web_hook_worker.rb @@ -1,11 +1,13 @@ -class ProjectWebHookWorker +class WebHookWorker include Sidekiq::Worker include DedicatedSidekiqQueue sidekiq_options retry: 4 def perform(hook_id, data, hook_name) + hook = WebHook.find(hook_id) data = data.with_indifferent_access - WebHook.find(hook_id).execute(data, hook_name) + + WebHookService.new(hook, data, hook_name).execute end end |