From 6bd9ae9c80d904007c62201fc8f554d7bd5ab441 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 19 Apr 2021 14:55:47 +0200 Subject: [PATCH] Count RfCs with comments in PostgreSQL for faster Prometheus initialization --- lib/prometheus/controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/prometheus/controller.rb b/lib/prometheus/controller.rb index d2d85767..5666fb4e 100644 --- a/lib/prometheus/controller.rb +++ b/lib/prometheus/controller.rb @@ -41,7 +41,7 @@ module Prometheus state: RequestForComment::SOLVED) # count of rfcs with comments - @rfc_commented_count.observe(RequestForComment.with_comments.count) + @rfc_commented_count.observe(RequestForComment.joins(:comments).distinct.count(:id)) end def update_notification(object)