FIX: No need to fload the logs during PG failover.

FIX: No need to fload the logs during PG failover.

diff --git a/lib/internal_metric/global.rb b/lib/internal_metric/global.rb
index 73e1ed2..d2d53fe 100644
--- a/lib/internal_metric/global.rb
+++ b/lib/internal_metric/global.rb
@@ -190,7 +190,12 @@ module DiscoursePrometheus::InternalMetric
             missing[{ db: db }] = Discourse.stats.get("missing_#{type}_uploads")
           end
         rescue => e
-          Discourse.warn_exception(e, message: "Failed to connect to database to collect upload stats")
+          if @postgres_master_available
+            Discourse.warn_exception(e, message: "Failed to connect to database to collect upload stats")
+          else
+            # TODO: Be smarter and connect to the replica. For now, just disable
+            # the noise when we failover.
+          end
         end
       end
 

GitHub sha: 8b2615a9