FIX: Backwards compatibility with Discourse `stable` branch take 2.

FIX: Backwards compatibility with Discourse stable branch take 2.

diff --git a/lib/internal_metric/global.rb b/lib/internal_metric/global.rb
index d09bbdc..fe8e3fb 100644
--- a/lib/internal_metric/global.rb
+++ b/lib/internal_metric/global.rb
@@ -148,15 +148,15 @@ module DiscoursePrometheus::InternalMetric
     end
 
     def missing_uploads(type)
-      if Discourse.respond_to?(:stats)
-        missing = {}
+      missing = {}
 
+      if Discourse.respond_to?(:stats)
         RailsMultisite::ConnectionManagement.each_connection do |db|
           missing[{ db: db }] = Discourse.stats.get("missing_#{type}_uploads")
         end
-
-        missing
       end
+
+      missing
     end
   end
 end

GitHub sha: f5f791f0

1 Like