From 99760edc757b24796d5db1f5328d55f483e4c33c Mon Sep 17 00:00:00 2001 From: Andrew8xx8 Date: Wed, 20 Feb 2013 15:33:03 +0400 Subject: [PATCH] Method moved to service --- app/models/system_hook.rb | 3 --- app/services/system_hooks_service.rb | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/system_hook.rb b/app/models/system_hook.rb index 3914a915..5cdf0466 100644 --- a/app/models/system_hook.rb +++ b/app/models/system_hook.rb @@ -12,7 +12,4 @@ # class SystemHook < WebHook - def async_execute(data) - Sidekiq::Client.enqueue(SystemHookWorker, id, data) - end end diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb index 1d53f3ba..6043bac6 100644 --- a/app/services/system_hooks_service.rb +++ b/app/services/system_hooks_service.rb @@ -7,10 +7,14 @@ class SystemHooksService def self.execute_hooks(data) SystemHook.all.each do |sh| - sh.async_execute data + async_execute_hook sh, data end end + def self.async_execute_hook(hook, data) + Sidekiq::Client.enqueue(SystemHookWorker, hook, data) + end + def self.build_event_data(model, event) data = { event_name: build_event_name(model, event),