PERF: Select distinct active web hooks at the db level.

This commit is contained in:
Guo Xiang Tan 2018-05-24 14:56:40 +08:00
parent 4fef9e95d2
commit 8a1aab4e8a
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class WebHook < ActiveRecord::Base
WebHook.where(active: true)
.joins(:web_hook_event_types)
.where("web_hooks.wildcard_web_hook = ? OR web_hook_event_types.name = ?", true, type.to_s)
.uniq
.distinct
end
def self.enqueue_hooks(type, opts = {}, web_hooks = nil)