mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-26 15:40:21 +00:00
Avoid excessive log output in the API thread.
Set log level for BaseHTTPRequestHandler request logging to debug. Avoid complains about PostgreSQL being unreachable if we know it is not running.
This commit is contained in:
+5
-1
@@ -243,13 +243,17 @@ class RestApiHandler(BaseHTTPRequestHandler):
|
||||
except (psycopg2.Error, RetryFailedError, PostgresConnectionException):
|
||||
state = self.server.patroni.postgresql.state
|
||||
if state in ['stopped', 'starting', 'stopping', 'restarting', 'running']:
|
||||
logger.exception('get_postgresql_status')
|
||||
if state == 'running':
|
||||
logger.exception('get_postgresql_status')
|
||||
state = 'unknown' if state == 'running' else state
|
||||
return {'state': state}
|
||||
|
||||
def get_tags(self):
|
||||
return {'tags': self.server.patroni.tags}
|
||||
|
||||
def log_message(self, format, *args):
|
||||
logger.debug("API thread: "+format % args)
|
||||
|
||||
|
||||
class RestApiServer(ThreadingMixIn, HTTPServer, Thread):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user