From 8a1aab4e8a3fbab93d6854c0c5e2258fe83a518e Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 24 May 2018 14:56:40 +0800 Subject: [PATCH] PERF: Select distinct active web hooks at the db level. --- app/models/web_hook.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb index 257357c4eae..a5cda0ce03e 100644 --- a/app/models/web_hook.rb +++ b/app/models/web_hook.rb @@ -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)