Commit f746c85b authored by Stan Hu's avatar Stan Hu

Fix Geo streaming check

Most of the pg_stat_wal_receiver values are hidden from non-superusers, but
the PID is all we can access.

Closes #4765
parent 59e051cf
...@@ -80,13 +80,12 @@ module Gitlab ...@@ -80,13 +80,12 @@ module Gitlab
def self.streaming_active? def self.streaming_active?
# Get a streaming status # Get a streaming status
# This only works for Postgresql 9.6 and greater # This only works for Postgresql 9.6 and greater
status = pid =
ActiveRecord::Base.connection.execute(' ActiveRecord::Base.connection.select_values('
SELECT * FROM pg_stat_wal_receiver;') SELECT pid FROM pg_stat_wal_receiver;')
.first .first
.fetch('status')
status == 'streaming' pid.to_i > 0
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment