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
def self.streaming_active?
# Get a streaming status
# This only works for Postgresql 9.6 and greater
status =
ActiveRecord::Base.connection.execute('
SELECT * FROM pg_stat_wal_receiver;')
pid =
ActiveRecord::Base.connection.select_values('
SELECT pid FROM pg_stat_wal_receiver;')
.first
.fetch('status')
status == 'streaming'
pid.to_i > 0
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